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', 'key3' ); $data = array( 'key1' => 10, 'key2' => 20, 'key3' => 30, 'key4' => 40 ); if(count(array_intersect_key(array_flip($required), $data)) === count($required)) { //All required keys exist! }
Output for 5.1.0 - 5.6.30, hhvm-3.10.1 - 3.17.3, 7.0.0 - 7.2.0
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function array_intersect_key() in /in/cmE8t 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/cmE8t 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/cmE8t 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/cmE8t on line 13