Jump to content

How


unidox

Recommended Posts

I'm no regex expert so cant give you any feedback on the efficiency of your regex. However you could modify you regex abit so it finds tags automatically, like:

function get_info($content)
{
$content = preg_replace('@\{([a-z]+)\}(.+)\{\/\1\}@is', "$1 = $2<br />", $content);
return $content;
}

$str = '{title}lala{/title}

{body}hello world{/body}';

echo get_info($str);

Link to comment
https://forums.phpfreaks.com/topic/116749-how/#findComment-600431
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.