FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » replacing spaces with newline
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: replacing spaces with newline [message #181314 is a reply to message #181307] Sat, 04 May 2013 14:43 Go to previous message
Simon Hall is currently offline  Simon Hall
Messages: 2
Registered: May 2013
Karma:
Junior Member
Thanks guys, it was going to be going to a text file anyway. Was me just being an idiot the output was correctly formatted in a text file rather than the output of echo in the webpage.

Thank you for the responses, we live and learn :)

On Saturday, 4 May 2013 12:09:06 UTC+1, Simon Hall wrote:
> Hi Guys,
>
>
>
> I am new to PHP and I am trying to clean up some text, what I am looking to do is to create a new line at each space, I have tried the following but it still outputs with just spaces.
>
>
>
> <?php
>
>
>
> $file = file_get_contents("mytext.txt");
>
>
>
> $file = Str_replace(" ", "\r\n", $file);
>
>
>
> echo $file;
>
>
>
> ?>
>
>
>
> Any ideas?
>
>
>
>
>
> Cheers
>
>
>
>
>
> Simon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: take two - fetch items from a row.
Next Topic: Unique array of arrays - how can I do this?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 06:44:48 GMT 2024

Total time taken to generate the page: 0.04150 seconds