jaymc Posted April 13, 2007 Share Posted April 13, 2007 I am creating a php script which will feed in some text from a textarea and produce an output The issue Im stuck with is getting rid of returns, Here is an example of what I want the code to do and the result it should give in raw data which is essentually to remove the page breaks. However, the code Ive give doesnt work test test test test How can I achieve this $statsb = str_replace("\r", "", $stats); test test test test Quote Link to comment https://forums.phpfreaks.com/topic/46797-remove-n/ Share on other sites More sharing options...
Guest prozente Posted April 13, 2007 Share Posted April 13, 2007 try this <pre><?php $data = 'test test test test'; $data = preg_replace(array("/\r/", "/(.*)(?:\n)+/"), array('',"\\1\n"), $data); echo $data; ?> </pre> Quote Link to comment https://forums.phpfreaks.com/topic/46797-remove-n/#findComment-228105 Share on other sites More sharing options...
clown[NOR] Posted April 13, 2007 Share Posted April 13, 2007 i just dont understand how you guys do it... I have tried for many days now, but I still cant figure out how to work that preg function Quote Link to comment https://forums.phpfreaks.com/topic/46797-remove-n/#findComment-228159 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.