Re: can't get any string replacements to clean this

From: Date: Fri, 14 Mar 2003 05:57:07 +0000
Subject: Re: can't get any string replacements to clean this
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139668@lists.php.net to get a copy of this message
Put the arguments inside of double quotes instead of single quotes and then try it. $bad_str = str_replace("\r","\n",$bad_str); ----- Original Message ----- From: "Dennis Gearon" <gearond@cvc.net> To: <php-general@lists.php.net> Sent: Thursday, March 13, 2003 11:51 PM Subject: [PHP] can't get any string replacements to clean this > All i get out of: > str_replace > ereg_replace > preg_replace > > is an empty string value. > Anybody know why? > > > <?PHP > $bad_str = " \t\t\t\\r\\\r\r\r\r\n\r\nFour > schore ...........and seven \n\n\n\n\nr\r\r\rn\r years > ago, ,,,,,,, ,,,,,,,our father created on tis planet > \t\t\t\\r\\\r\r\r\r\n\r\nFour "; > > echo( "<br>\nuncleaned > string-------------------------------------<br>\n"); > echo($bad_str . "<br>\nn" ); > echo( "<br>\ncleaned > --------------------------------------------<br>\n"); > > //Nothing will clean on this line > $bad_str = preg_replace( '\r', '\n', $bad_str ); > echo("</pre>\n"); > ?> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#139668) next »