select only one attribute from php multidimensional array? -


supposedly have array this:

$shop = array( array("name"=>"tom", "level"=> 1.25 ),                array("name"=>"mike","level"=> 0.75 ),                array("name"=>"john","level"=> 1.15 )               );  

how make array name values , keys being position of theri original array. know iterate through, , put in array, there functions?

sorry if confusing. desired output be:

array(0=>"tom",1=>"mike",2=>"john"); 

so basicaly select in sql.

as of php 5.3.0 can use this:

$result = array_map(     function($x) {         return $x['name'];     }, $shop);  print_r($result); 

prior 5.3.0 can use create_function callback.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -