fork download
  1. <?php
  2. $arr = array('first' => array("id"=>1,"name"=>"test","value"=>3),'second' => array("id"=>2,"name"=>"test2","value"=>4));
  3. $arr= json_encode($arr);
  4. $name_arr=array();
  5. foreach(json_decode($arr) as $val){
  6. $name_arr[]=$val->name;
  7. }
  8.  
  9. var_dump($name_arr);
  10. ?>
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
array(2) {
  [0]=>
  string(4) "test"
  [1]=>
  string(5) "test2"
}