3v4l.org

run code in 300+ PHP versions simultaneously
<?php $o = (object)array(42); var_dump(array_key_exists(0, $o)); var_dump($o->{0});
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, stdClass given in /in/Hk6V2:5 Stack trace: #0 {main} thrown in /in/Hk6V2 on line 5
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/Hk6V2 on line 5 bool(false) int(42)
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
bool(false) int(42)
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
bool(true) Notice: Undefined property: stdClass::$0 in /in/Hk6V2 on line 7 NULL

preferences:
207.15 ms | 402 KiB | 331 Q