RE: [PHP] Curl output to an array -- HELP!! -- Appended

From: Date: Wed, 20 Mar 2002 00:05:23 +0000
Subject: RE: [PHP] Curl output to an array -- HELP!! -- Appended
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89237@lists.php.net to get a copy of this message
On Wed, 20 Mar 2002, Martin Towell wrote: > (this code not tested) > > <? > $res_arr = explode("\n", $result); > $res_num = count($res_arr); > for ($i = 0; $i < $res_num; $i++) > { > list($k, $v) = explode("=", $res_arr[$i]); > $$k = $v; > } > ?> > > this isn't going to work properly if the "value" part has an "=" in it > - in > that case, change the explode("=", ...) line to use strtok() or > strpos()/substr() Explode takes an optional third argument, which limits the amount of shrapnel produced. So just change that line to: list($k, $v) = explode("=", $res_arr[$i], 2); and you're the Egyptian god of the underworld. miguel

« previous php.general (#89237) next »