PHP Convert Array To An Associative Array -


how convert array

array (     [1] => a,b,c     [2] => x,y,z ) 

into associative array like

array (   [a]=> b,c   [x]=> y,z ) 

basically want convert value of array key.

try out this,

$newarray = array(); foreach($array $data){     $values = explode(",",$data);     $key = array_shift($values);     $newarray[$key] = implode($values,","); } print_r($newarray); 

demo.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -