I have an array like
$arr(
$name => "vinu",
$street0 => "xxx",
$street1 => "yyy"
)
I need to convert this as
$arr1(
$name => "vinu",
$street => array("xxx", "yyy")
)
How can I do this?
like
foreach($ary as $k => $v)
if(preg_match("~(.+?)(\d+)$~", $k, $m))
$out[$m[1]][$m[2]] = $v;
else
$out[$k] = $v;
basically, if a key is "something and digits" put its value into result[something][digits] otherwise simply copy the value into the result array
$name$street0and$street1look like ?