3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo $foo; class testing { public $prop = 'property'; } $t = new testing(); echo "Normal prop: ".$t->prop."\n"; echo "Dynamic prop: ".$t->prop2."\n"; $t->prop2 = 'dynamic prop'; echo "Dynamic prop: ".$t->prop2."\n";
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Warning: Undefined variable $foo in /in/dgOYV on line 3 Normal prop: property Warning: Undefined property: testing::$prop2 in /in/dgOYV on line 11 Dynamic prop: Deprecated: Creation of dynamic property testing::$prop2 is deprecated in /in/dgOYV on line 12 Dynamic prop: dynamic prop
Output for 8.1.0 - 8.1.33
Warning: Undefined variable $foo in /in/dgOYV on line 3 Normal prop: property Warning: Undefined property: testing::$prop2 in /in/dgOYV on line 11 Dynamic prop: Dynamic prop: dynamic prop

preferences:
70.47 ms | 407 KiB | 5 Q