Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

bbcode font-size



4:31 am on Nov 11, 2009 (gmt 0)

5+ Year Member

how you retrieve the font size from bbcode for example:


i want to use preg_replace to turn that into <span style="font-size: {number};">{text}</span>
this will be with a whole array, where the 'pre-replaced' tag is the key in an array, and the value i want to replace it with is the value like this:

$root = array(
"/blah/" => "cool"

thanks :D


6:22 am on Nov 11, 2009 (gmt 0)

10+ Year Member

$find = array(key($root), current($root));
$replace = array("{number}","{text}");
$content = "[size={number}]{text}[/size]";

echo str_replace($find, $replace, $content);


6:24 am on Nov 11, 2009 (gmt 0)

10+ Year Member

you could also use those values as tokens.. and learn from vincevincevince's one line template engine post.

One line template engine [webmasterworld.com]



4:48 pm on Nov 11, 2009 (gmt 0)

5+ Year Member

ok yeh im using that except using the grouped variable thins like "$1" and "$2", is there anyone to do math and divide one by 2? when i try like "content...".$1/2."more content" it like says unexpected number, this is in one of the arrays to do preg_replace by the way.

Featured Threads

Hot Threads This Week

Hot Threads This Month