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 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '$get' (T_VARIABLE) in /in/NKP57 on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/NKP57 on line 3
Process exited with code 255.