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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php