.Darkman Posted March 9, 2007 Share Posted March 9, 2007 Hello all, I am new to PHP. I used this to create a function function html_parse($str) { strip_tags($str, '<b><i><u><s><a><img><br>'); } And i used the function as : $comment = $_POST['comment']; $comment = html_parse($comment); It didn't work. Could some one tell me how to do it ? Thanks, Link to comment https://forums.phpfreaks.com/topic/41912-solved-functions/ Share on other sites More sharing options...
kenrbnsn Posted March 9, 2007 Share Posted March 9, 2007 You need to return a value from the function for it to affect a variable outside it's scope. <?php function html_parse($str) { return(strip_tags($str, '<b><i><u><s><a><img><br>')); } ?> Ken Link to comment https://forums.phpfreaks.com/topic/41912-solved-functions/#findComment-203232 Share on other sites More sharing options...
.Darkman Posted March 9, 2007 Author Share Posted March 9, 2007 Oh thanks, While i was posting a reply, you posted one. Very quick thanks. i corrected myself and used this : function html_parse($str) { $var = strip_tags($str, '<b><i><u><s><a><img><br>'); return $var; } Anyway, yours seems smaller. Thanks, Link to comment https://forums.phpfreaks.com/topic/41912-solved-functions/#findComment-203233 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.