3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //The values in this arrays contains the names of the indexes (keys) that should exist in the data array $required = array('key1', 'key2', 'key30' ); $data = array( 'key1' => 10, 'key2' => 20, 'key3' => 30, 'key4' => 40 ); if(count(array_intersect_key(array_flip($required), $data)) === count($required)) { echo "all exist"; }else{ echo "fail"; }
based on 70QIk
Output for 5.1.0 - 7.2.0
fail
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function array_intersect_key() in /in/XlHTU on line 13
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: array_intersect_key() in /in/XlHTU on line 13
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: array_intersect_key() in /in/XlHTU on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: array_intersect_key() in /in/XlHTU on line 13