I am currently making a BBCode class for my website. I need to do the following.
function bbCode([skill]Q[/skill]_________[skill]Q[/skill]_________[skill]Q[/skill]);
bbCode function has to replace all Q's between [skill] and [/skill] tags, and replace it with $skillArray['Q'] value. ($skillArray is character dependant.)
How can I do this?
A little clearer version is:
Ps. Don't want to use explode.
Assuming the tags you want to be replaced are within some form of template, you could use file_get_contents and then loop through the tags you want to replace with the desired values, for example:
$file = file_get_contents ( 'yourfile.php' );
$skillArray = array ( 'Q' => 'Hunter name' );
foreach ( $skillArray as $key => $val )
{
$file = str_replace ( '[skill]' . $key . '[\skill]', $val, $file );
}
Thats just a completely rough example, but if I'm understanding what you are trying to do; that should be along the right lines....