Re: exploding strings

From: Date: Wed, 20 Nov 2002 08:25:54 +0000
Subject: Re: exploding strings
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-125202@lists.php.net to get a copy of this message
At 05:54 20.11.2002, Michael P. Carel said: --------------------[snip]-------------------- >Hi to all, > >I have a problem regarding exploding string. I want to explode string >sepated by "+" sign, but i want it also the first variable in the array be >distinc in terms of collor or whatever when viewed in the page. > >ex. > >$no=("1+2+3"); >$number=explode("+", $no); > >how could i echo $no with the first no. "1" be in colored. --------------------[snip]-------------------- You need to handle the first element separately, then chime in with the rest: $string = '1+2+3'; $as = explode('+',$string); echo '<font color="red">',array_shift($as), '</font>, ', join(', ', $as); -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#125202) next »