3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { private $a = 0; } $a = new A(); $b = (object)[chr(0) . 'A' . chr(0) . 'a' => 1]; $c = json_decode('[ "' . chr(0) . 'A' . chr(0) . 'a' . '":"2" ]'); echo $c->{chr(0) . 'A' . chr(0) . 'a'}; echo $b->{chr(0) . 'A' . chr(0) . 'a'}; echo $a->{chr(0) . 'A' . chr(0) . 'a'};
based on EVKjg
Output for 7.2.0 - 7.2.6
Notice: Trying to get property '' of non-object in /in/bMEQb on line 11 Fatal error: Uncaught Error: Cannot access property started with '\0' in /in/bMEQb:12 Stack trace: #0 {main} thrown in /in/bMEQb on line 12
Process exited with code 255.
Output for 7.0.0 - 7.1.20
Notice: Trying to get property of non-object in /in/bMEQb on line 11 Fatal error: Uncaught Error: Cannot access property started with '\0' in /in/bMEQb:12 Stack trace: #0 {main} thrown in /in/bMEQb on line 12
Process exited with code 255.
Output for hhvm-3.15.4
Notice: Cannot access property on non-object in /in/bMEQb on line 11 1 Fatal error: Uncaught Error: Cannot access property started with '\0' in /in/bMEQb:13 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Notice: Trying to get property of non-object in /in/bMEQb on line 11 Fatal error: Cannot access property started with '\0' in /in/bMEQb on line 12
Process exited with code 255.