Posted by J2be on 02/01/06 07:05
<namemattersnot@msn.com> wrote in message
news:1138769405.939967.34680@z14g2000cwz.googlegroups.com...
> re,
>
> $a = "&key1=val2&key2=val2&key3=val3"'
> how do I make the following array out of $a:
>
> array['values']['key1']
> ['key2']
> ['key3']
<?php
$a = "&key1=val2&key2=val2&key3=val3";
$tmpar = split('&',$a);
foreach($tmpar as $tmpval)
{
if($tmpval != '')
{
$tmpkval = split('=',$tmpval);
$aarray['values'][$tmpkval[0]] = $tmpkval[1];
}
}
print_r($aarray);
?>
Cheers
--
----
Leonardo Armando Iarrusso - J2Be
www: http://www.J2be.com - e-mail: info[at]J2Be.com
Navigation:
[Reply to this message]
|