3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Person { public $name = 'Jackie'; public $job = 'PHP Developer'; } // Create instance $person = new Person(); $property = ['first' => 'name', 'second' => 'job']; echo "\nMy name is " . $person->{$property['first']} . "\n"; echo "\nMy job is " . $person->$property['second'] . "\n";
based on UbEEq
Output for 7.0.0 - 7.2.0
My name is Jackie Notice: Array to string conversion in /in/roEpt on line 12 Notice: Undefined property: Person::$Array in /in/roEpt on line 12 My job is
Output for 5.4.10 - 5.6.28
My name is Jackie My job is PHP Developer
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/roEpt on line 9
Process exited with code 255.