Hi guys,
I'm having a problem with the split function.
It doesn't work like I want it to...
This code converts bbcode into html.PHP Code:
$msg = str_replace("[B]", '<b>', $msg); $msg = str_replace("[/B]", '</b>', $msg); $msg = str_replace("[U]", '<u>', $msg); $msg = str_replace("[/U]", '</u>', $msg); $msg = str_replace("[I]", '<i>', $msg); $msg = str_replace("[/I]", '</i>', $msg); $msg = str_replace('\\', '', $msg); $urlmsg = @split('[URL="', $msg); #$msg = $urlmsg[0]; if ($urlmsg !== false){ echo $urlmsg; $urlmsg = split('"]', $urlmsg); $url = $urlmsg; $urlmsg = split('[URL="'.$url.'"]', $msg); $urlmsg = split('[/URL]', $msg); $msg = str_replace('[URL="'.$url.'"]'.$urlmsg.'[/URL]', '<a href="'.$url.'">'.$urlmsg.'</a>', $msg); } $img = @split('[IMG="', $msg); if ($img !== false){ $imgurl = split('"]', $img); $msg = str_replace('[IMG="'.$imgurl.'"]', '<img src="'.$imgurl.'" />', $msg); }
With slight syntax changes this would work for me in VB, but somehow PHP is a little more stubborn to my side...![]()
Anyone?
Thanks in advance




Reply With Quote