You are here: Re: [PHP] explode a string « PHP « IT news, forums, messages
Re: [PHP] explode a string

Posted by Richard Lynch on 04/19/05 05:29

On Mon, April 18, 2005 4:34 am, Sebastian said:
> $string = '4:gaming,5:hardware,3:software,8:security';

$idcats = explode(',', $string);
while (list(, $idcat) = each($idcats)){
list($id, $cat) = explode(':', $idcat);
echo "\$id = $id<br />\n";
echo "\$cat = $cat<br />\n";
}

> 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.

200 bytes is chump-change.

It really doesn't matter how you do this, within reason.

--
Like Music?
http://l-i-e.com/artists.htm

 

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

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