fork download
  1. <?php
  2.  
  3. // your code goes here
  4. $arr = [1 => 'bar', 2 => 'bin', 3 => 'ipsum', 4 =>'hz'];
  5. $foundUnicIds = [2, 4];
  6. //$numeric_indexed_array = array_values($arr);
  7.  
  8. foreach($foundUnicIds as $eachId){
  9. //print_r($numeric_indexed_array[$eachId]); // выводим найденную линию с результатом
  10. echo "Id = $eachId\tElement = {$arr[$eachId]}". PHP_EOL;
  11. // $eachId++;
  12. }
Success #stdin #stdout 0.01s 82560KB
stdin
Standard input is empty
stdout
Id = 2	Element = bin
Id = 4	Element = hz