3v4l.org

run code in 300+ PHP versions simultaneously
<?php $o = (object)array(42); var_dump(array_key_exists(0, $o), property_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.6
Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, stdClass given in /in/gB7Vc:5 Stack trace: #0 {main} thrown in /in/gB7Vc 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/gB7Vc on line 5 Warning: property_exists() expects parameter 2 to be string, object given in /in/gB7Vc on line 5 bool(false) NULL int(42)
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Warning: property_exists() expects parameter 2 to be string, object given in /in/gB7Vc on line 5 bool(false) NULL 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
Warning: property_exists() expects parameter 2 to be string, object given in /in/gB7Vc on line 5 bool(true) NULL Notice: Undefined property: stdClass::$0 in /in/gB7Vc on line 7 NULL

preferences:
219.2 ms | 402 KiB | 330 Q