sql - PHP Change Array Structure / Format -
i have array @ present looks this:
array ( [0] => array ( [language] => english ) [1] => array ( [language] => arabic ) [2] => array ( [language] => bengali ) )
what i'd change looks this:
array ( [language] => array ( [0] => english [1] => arabic [2] => bengali ) )
i have array looks this:
array ( [id] => 3 [name] => lethalmango [joined] => 2010-01-01 00:00:00 )
and i'd change to:
array ( [user] => array ( [id] => 3 [name] => lethalmango [joined] => 2010-01-01 00:00:00 ) )
i've tried number of methods without success i'm sure there more efficient way.
first : $result = array(); foreach($array $value){ $result['language'][]= $value['language'] } second : $result['user'] = $array;
Comments
Post a Comment