Re: [PHP] newline in string
Thanks everyone. I'' be breaking the string after the newline so that I can convert the html to php echos and write them to a file. -Shawn "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 000d01c272c1$54d0$7c02a8c0@coconut">news:000d01c272c1$54d0$7c02a8c0@coconut... > > I have loaded an html file into a string. How can I search the string > for > > newlines/linefeeds? I know they are there, because if I echo the > string > > and > > view source in the browser, some tags are on new lines. > > > > Example: > > > > > > > > > > And do what when you find them? If you just want to know if there are > newlines in the file, then use strstr(). If you want to remove or > replace them, then use str_replace(). If you want to add in a where > some newlines are, then use nl2br(). > > ---John Holmes... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newline in string
On Sunday 13 October 2002 17:24, Shawn McKenzie wrote: > I have loaded an html file into a string. How can I search the string for > newlines/linefeeds? I know they are there, because if I echo the string and > view source in the browser, some tags are on new lines. > > Example: > > > > Search for "\r" and "\n" for linefeeds and newlines respectively. Note you must use double-quotes. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* >From the cradle to the coffin underwear comes first. -- Bertolt Brecht */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newline in string
> I have loaded an html file into a string. How can I search the string for > newlines/linefeeds? I know they are there, because if I echo the string > and > view source in the browser, some tags are on new lines. > > Example: > > > > And do what when you find them? If you just want to know if there are newlines in the file, then use strstr(). If you want to remove or replace them, then use str_replace(). If you want to add in a where some newlines are, then use nl2br(). ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php