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 ? Quote 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 Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/50101-solved-watch-out-newbie/#findComment-246020 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.