fork(1) download
  1. <?php
  2.  
  3. $hidden = [
  4. 'apples' => 19,
  5. 'eggs' => 7,
  6. 'grapes' => 144,
  7. 'mushrooms' => 3,
  8. 'oranges' => 16
  9. ];
  10.  
  11. $list = ['grapes', 'apples', 'eggs', 'oranges'];
  12.  
  13. $klist = array_flip($list);
  14. print_r(array_values(array_intersect_key(array_replace($klist, $hidden), $klist)));
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 144
    [1] => 19
    [2] => 7
    [3] => 16
)