You are here: Re: explode() behaviour? « PHP Language « IT news, forums, messages
Re: explode() behaviour?

Posted by Kimmo Laine on 08/29/05 15:57

"Frank Bemelman" <f.bemelmanq@xs4all.invalid.nl> wrote in message
news:4312ffba$0$11178$e4fe514c@dreader20.news.xs4all.nl...
> Dear group,
>
> I'm trying to explode a tab delimited string into
> an array of strings, using explode.
>
> It seems that when I explode "\t\t\tone\ttwo\tthree\tfour"
> it gives me 4 strings: "one", "two", "three", "four".
>
> I expected to get 6 strings: "","","one", "two", "three", "four".
>
> Is this normal behaviour, or is there another method
> to get what I want?


I got exactly what you expected to get. Using PHP5 on IIS6/Win2003.

$kaboom = explode ("\t", "\t\t\tone\ttwo\tthree\tfour");
var_dump($kaboom);

prints
array(7) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
string(0) ""
[3]=>
string(3) "one"
[4]=>
string(3) "two"
[5]=>
string(5) "three"
[6]=>
string(4) "four"
}

--
Welcome to Usenet! Please leave tolerance, understanding
and intelligence at the door. They aren't welcome here.
eternal piste erection miuku gmail piste com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация