|
Posted by Bent Stigsen on 05/29/06 12:50
frizzle wrote:
> Toby Inkster wrote:
>> frizzle wrote:
>>
>>> Only now if there are two slashes behind each other
>>> (folder//subfolder)
>> Best thing is to make sure explode() never even sees that.
>>
>> <?php
>> $url = 'folder//subfolder/////somefile';
>>
>> while (strstr($url, '//'))
>> $url = str_replace('//', '/', $url);
>>
>> $parts = explode('/', $url);
[snip]
> Well, i figured right now, explode ignores it, and goes past it.
> The way you present it, is axactly what it does right now w/o any
> str_repl().
Can you post an example of code that will do that. You must be doing
something else that removes the empty values.
> What i'd like is to have $array[1] to be empry or null, etc.
That is what explode should give you, if you got nothing in between
two separators. If you take Toby's code without the while/str_replace,
then you should get:
Array
(
[0] => folder
[1] =>
[2] => subfolder
[3] =>
[4] =>
[5] =>
[6] =>
[7] => somefile
)
/Bent
[Back to original message]
|