3v4l.org

run code in 300+ PHP versions simultaneously
<?php $someClass = new SomeClass; class SomeClass { public $value; }; var_dump(array_key_exists('value', $someClass)); var_dump(property_exists($someClass, 'value'));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, SomeClass given in /in/69mpd:9 Stack trace: #0 {main} thrown in /in/69mpd on line 9
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in /in/69mpd on line 9 bool(true) bool(true)
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33
bool(true) bool(true)

preferences:
78.12 ms | 409 KiB | 5 Q