Jump to content

replacing [b] with <b>


Clarkeez

Recommended Posts

You're close

$data['post'] = str_replace('[b]', '<b>', $data['post']); 
$data['post'] = str_replace('[/b]', '</b>', $data['post']);
echo $data['post'];

 

Or you can use regex

$data['post'] = preg_replace('~\[b\](.*?]\[/b\]~', '<b>$1</b>', $data['post']);
echo $data['post'];

Link to comment
https://forums.phpfreaks.com/topic/240942-replacing-b-with/#findComment-1237605
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.