Re: Strange explode()

From: Date: Tue, 26 Oct 2004 16:31:29 +0000
Subject: Re: Strange explode()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-200372@lists.php.net to get a copy of this message
> Hi, > Any idea why it is taking the first array as blank and giving me an array > count of 3 instead of 2? > <? > $final="7ü1‡‡3˜§p½û— > ÚüÝhttp://something.com/cgi-bin/atx/out.cgi?s=63&c=1&l=gals&u=http://bl > ah.something.com/bs3/index1.htm"; > $final2=explode("http://",$final); > $res=count($final2); > echo "<br><br><br>".$res; > print_r($final2); > ?> > > This is the output that is confusing me: > Array > ( > [0] => > [1] => something.com/cgi-bin/atx/out.cgi?s=63&c=1&l=gals&u= > [2] => blah.something.com/bs3/index1.htm > ) > > Thanks, > Ryan Not sure what you're thinking of explode means but the above is correct. You've defined http:// as the boundry so anything before and after the boundry is placed into the final2 array. http:// appears twice in your string. -- --Matthew Sims --<http://killermookie.org>

« previous php.general (#200372) next »