At 19:17 26-2-03, you wrote:
On Thu, 27 Feb 2003 01:02:54 +0800, Jason Wong wrote:
>On Thursday 27 February 2003 00:54, {R}ichard Ashton wrote:
>> I have the body ov a Usnet article, all of it, in $body. I want to
>> split it into lines.
>>
>> I have tried
>>
>> $lines = explode( X, $body);
>>
>> where I have used
>>
>> X = "0x0A"
>> X = '0x0A'
>> X = "0x0D"
>> X = '0x0A'
>> X = "\r"
>X = "\r"
X = '\r'
X = "\n"
X = '\n'

I then have

echo "pieces $pieces[0] <br>";
echo "pieces $pieces[1] <br>";
echo "pieces $pieces[2] <br>";
echo "pieces $pieces[3] <br>";
echo "pieces $pieces[4] <br>";
echo "pieces $pieces[5] <br>";

If I look at $body with Hex editor there are lots of 0D 0A pairs and
further if I look at the source of the page generated by

echo $body; I can see the CRLF's

I think 0D0A is "\r\n" (double quotes!).
Maybe you can start with str_replacing all "\r\n" and "\r" with "\n" so you can explode by "\n" only. Use double quotes for best result.


Chris H.




-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to