ted_chou12 Posted February 2, 2007 Share Posted February 2, 2007 the purpose of this code is to help users that forgets to close text decorations to close them, since if they are not closed, the rest of the page becomes messy: function textcodes($message,$type) { $number1 = substr_count($message, "[$type]"); $number2 = substr_count($message, "[/$type]"); while ($number1 > $number2) { $message = "$message"."[/$type]"; $number1 = substr_count($message, "[$type]"); $number2 = substr_count($message, "[/$type]");}} textcodes($message, "b"); textcodes($message, "u"); textcodes($message, "i"); textcodes($message, "cod"); textcodes($message, "quo"); textcodes($message, "img"); textcodes($message, "url"); HOwever, it is not achieving its purpose... that is it doesnt close any text decoration codes at all, can anyone suggest me why? Thanks Ted Link to comment https://forums.phpfreaks.com/topic/36768-solved-while/ Share on other sites More sharing options...
ted_chou12 Posted February 2, 2007 Author Share Posted February 2, 2007 nevermind, i am a clever man, solved it by myself... nevermind hey, the code turns n v m//without the space, because it automatically converts the match string! to nevermind Ted Link to comment https://forums.phpfreaks.com/topic/36768-solved-while/#findComment-175376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.