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

Posted by Saswat Praharaj on 04/20/05 15:47

explode by ","
$output1 = explode(",",$string);

use a loop and explode array $output1 by ":"

Hope this helps.

Saswat

On 4/18/05, Sebastian <sebastian@broadbandgaming.net> 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..?
>
> thanks.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

 

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

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