fork(2) download
  1. <?php
  2.  
  3.  
  4. $bigArray = array(
  5. 'name'=>'one',
  6. 'something'=>array(
  7. 'name'=>'two',
  8. 'subthing'=>array('name'=>'three')
  9. ),
  10. 'anotherthing'=>array('name'=>'one')
  11. );
  12.  
  13. $uniques = array();
  14.  
  15. function singleOut($item, $key, &$uniques) {
  16. if ($key == 'name' && !in_array($itm,$uniques,true) ) $uniques[] = $item;
  17. }
  18.  
  19. array_walk_recursive($bigArray, 'singleOut', $uniques);
  20.  
  21. print_r($uniques);
Success #stdin #stdout #stderr 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
)
stderr
PHP Notice:  Undefined variable: itm in /home/WnfT3e/prog.php on line 9
PHP Notice:  Undefined variable: itm in /home/WnfT3e/prog.php on line 9
PHP Notice:  Undefined variable: itm in /home/WnfT3e/prog.php on line 9
PHP Notice:  Undefined variable: itm in /home/WnfT3e/prog.php on line 9