Re: explode a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 18 April 2005 14:34, Sebastian wrote:
> $string = '4:gaming,5:hardware,3:software,8:security';
>
> what is the best way to explode then loop this string after its taken
> apart.
>
> output should be something like:
>
> $id = 4
> $cat = gaming
>
> etc..
>
> im just looking for the best/fastest way to do this. the string can grow to
> 200 or so bytes, maybe more.
>
> should i list(), while(), explode it, or should i explode it and foreach
> it? or..?

while is faster than foreach. check the iterator section in SPL for details.

>
> thanks.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: pgplCSdXyVzbv.pgp
Description: PGP signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux