3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { public $myAge public $myName public $gender public function __construct($myName, $myAge, $gender) { this->$myName; this->$myAge; this->$gender; } public function greet() { return "Hello my name is" .this->$myName."My age is ".this->$myAge."dude!!!".$gender; } $me = new Person("martin", 28, "man"); $me->greet(); } ?>
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.29, 5.6.7 - 5.6.13
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting ',' or ';' in /in/rbKje on line 4
Process exited with code 255.

preferences:
189.48 ms | 1395 KiB | 63 Q