3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $allowedKeys = array('foo','baz'); $get = array('foo' => 'bar', 'baz' => 'bat'); $post = array('foo' => 'bar', 'baz' => 'bat'); if ((array_keys($get) === $allowedKeys) && (array_keys($post) === $allowedKeys) ) { echo "PASS\n"; } $get['notallowed'] = 'naughty'; if ((array_keys($get) === $allowedKeys) && (array_keys($post) === $allowedKeys) ) { echo "FAIL\n"; } else { echo "PASS\n"; } unset($get['notallowed']); $post['notallowed'] = 'naughty'; if ((array_keys($get) === $allowedKeys) && (array_keys($post) === $allowedKeys) ) { echo "FAIL\n"; } else { echo "PASS\n"; }
Output for 4.3.0 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
PASS PASS PASS