|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-07-03 02:31 UTC] BlackMagic at computer dot org
I'm using explode() to parse a street address from a web form looking for 0x0D characters, eg, $x = explode(0x0D, $address);
The entire address ends up in $x, no matter how many line feeds it contains.
The same thing happens with this code:
$linefeed = 0x0D;
$x = explode($linefeed, $address);
This works, returning the correct value in $lines:
$y = $lines = 0;
$x = 1;
while ($x) {
$x = strpos($address, 0x0D, $y);
$y = $x + 1;
$lines++; }
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 18:00:02 2025 UTC |
From the manual: explode -- Split a string by string Description array explode ( string separator, string string [, int limit]) Your separator is 0x0D which is 13. Becuase 13 is not a 'string' it will be converted to the string "13" and aas there is no "13" in your string, it won't be exploded. User the following line instead: explode ("\n", $address); Derick