fork download
  1. <?php
  2.  
  3. // your code goes here
  4.  
  5. $arr[] = [
  6. 'what' => 'b4',
  7. 'map' => '74,76,77,83'
  8. ];
  9. $arr[] = [
  10. 'what' => 'b2',
  11. 'map' => '53,82'
  12. ];
  13. $arr[] = [
  14. 'what' => 'b1',
  15. 'map' => '36'
  16. ];
  17.  
  18. echo abc('b4', $arr);
  19.  
  20. function abc($what, $arr){
  21. $map = null;
  22. $idx = array_search($what, array_column($arr, 'what'));
  23. if ($idx !== false) {
  24. $map = $arr[$idx]['map'];
  25. }
  26. return $map;
  27. }
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
74,76,77,83