StumbleUpon  Del.icio.us  Facebook  Reddit  Add to diigo  


Follow - Monx007
Article Time Stamp: 25 January 2009, 23:16:14 GMT+7

PHP: Replacing Carriage Returns



QUESTIONS
I'm trying to remove all carriage returns in the input i get from GET, and am trying to replace them with three dots, however, this never seems to work. I'm still getting carriage returns.


ANSWER
Instead of using the character codes, you can use escape sequences. Carriage Return is \r and New Line is \n.

So, you can wrote your PHP script like this:
$clean_text = str_replace("\r","...",$_GET['text']);

Article Source: Monx Digital Library

Copyrighted@ Monx Digital Library, otherwise stated
Use of our service is protected by our Terms of Use



 Back To Previous Page ...  



 

 

 

AQWorlds Banner