igorpan Posted May 5, 2007 Share Posted May 5, 2007 Maybe it's funny , but , I don't know how to solve this problem... $string = "Some text [img=http://www.image.com/image.jpg] again some text ..."; I want to change string to : Some text <img src="http://www.image.com/image.jpg> again some text ... Can anyone help me ? Link to comment https://forums.phpfreaks.com/topic/50101-solved-watch-out-newbie/ Share on other sites More sharing options...
MadTechie Posted May 5, 2007 Share Posted May 5, 2007 try <?php $string = "Some text [img=http://www.image.com/image.jpg] again some text ..."; echo preg_replace('#\[img\](.*)\[\/img\]#i', '<img src="$1">', $string); ?> also search forum for BBcodes Link to comment https://forums.phpfreaks.com/topic/50101-solved-watch-out-newbie/#findComment-246015 Share on other sites More sharing options...
igorpan Posted May 5, 2007 Author Share Posted May 5, 2007 Hey , thanks , it works Link to comment https://forums.phpfreaks.com/topic/50101-solved-watch-out-newbie/#findComment-246020 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.