Re: Need difficult help !

From: Date: Fri, 15 Nov 2002 11:07:35 +0000
Subject: Re: Need difficult help !
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-124590@lists.php.net to get a copy of this message
On Friday 15 November 2002 18:39, Hacook wrote: > Hi all, > I have a very long charachter chain which is like that : > > Number*link*name*Number*link*name*Number*link*name*Number*link*name* > > I made a php script to cut it thanks to the "*" to make a list with a > number, and the name hyperlinked to the link. > The thing is that after i get a data (number, link or name), i use > str_replace to cut it off the chain to get the next one. > But as my numbers are sometime the same, i have troubles because it cuts > all the same numbers off. > Can i just cut one ? > Thanks a lot for reading me and maybe answer me ? :-) One way to do this: (Untested, use with extreme caution) ----------------------------------------------------------- $pieces = explode('*', $long_character_chain); while (!empty($pieces)) { $number = array_shift($pieces); $link = array_shift($pieces); $name = array_shift($pieces); // do whatever you need to make your link } ----------------------------------------------------------- -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Most people have two reasons for doing anything -- a good reason, and the real reason. */

« previous php.general (#124590) next »