fork(1) download
  1. <?php
  2.  
  3. $records = [
  4. [
  5. 'id' => 2135,
  6. 'first_name' => 'John',
  7. 'last_name' => 'Doe',
  8. 'owner' => [
  9. [
  10. 'id' =>345,
  11. 'first_name' => 'Johnsssss',
  12. 'last_name' => 'Doe'
  13. ]
  14. ]
  15. ],
  16. [
  17. 'id' => 3245,
  18. 'first_name' => 'Sally',
  19. 'last_name' => 'Smith',
  20. 'owner' => [
  21. [
  22. 'id' => 345,
  23. 'first_name' => 'Johnddddd',
  24. 'last_name' => 'Doe'
  25. ]
  26. ]
  27. ],
  28. [
  29. 'id' => 5342,
  30. 'first_name' => 'Jane',
  31. 'last_name' => 'Jones',
  32. ],
  33. [
  34. 'id' => 5623,
  35. 'first_name' => 'Peter',
  36. 'last_name' => 'Doe',
  37. ]
  38. ];
  39.  
  40. $first_names = array_column($records['owner'], 'id');
  41. print_r($first_names);
Success #stdin #stdout #stderr 0.02s 52480KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Notice:  Undefined index: owner in /home/HHrCjd/prog.php on line 40
PHP Warning:  array_column() expects parameter 1 to be array, null given in /home/HHrCjd/prog.php on line 40