graham23s Posted April 26, 2008 Share Posted April 26, 2008 Hi GUys, i wrote this basic function to deal with the ' and line breaks but im never sure in which order to apply them: <?php function clean_junk($string) { // apply the functions // $string = nl2br(stripslashes($string)); // return the string cleansed // return mysql_real_escape_string($string); } ?> i never remember in which order to apply them or does it matter? nl2br(stripslashes or stripslashes(nl2br just incase it does matter lol cheers Graham Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 26, 2008 Share Posted April 26, 2008 Use nl2br first. I think stripslashes removes the \ in \n. Not sure though. Quote Link to comment Share on other sites More sharing options...
graham23s Posted April 26, 2008 Author Share Posted April 26, 2008 sounds good to me DW, ill do it that way:) Graham Quote Link to comment Share on other sites More sharing options...
moselkady Posted April 26, 2008 Share Posted April 26, 2008 Looks like stripslashes() doesn't affect \n. I tried this cod in the command line and \n is still preserved: <?php $s = "1\n2\n"; echo stripslashes($s); ?> So, I think the order doesn't matter Quote Link to comment Share on other sites More sharing options...
graham23s Posted April 26, 2008 Author Share Posted April 26, 2008 thanks for testing mate:) Quote Link to comment 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.