<?php
class Person {
public $myAge;
public $myName;
public $gender;
public function __construct($myName, $myAge, $gender) {
$this->firstname = $myName;
$this->leeftijd = $myAge;
$this->geslacht = $gender;
}
public function greet() {
return "Hello my name is ".$this->firstname ."My age is ".$this->leeftijd ."dude!!!".geslacht;
}
}
$me = new Person('martin', 28, 'man');
$me->greet();
?>
Deprecated: Creation of dynamic property Person::$firstname is deprecated in /in/EX0K4 on line 8
Deprecated: Creation of dynamic property Person::$leeftijd is deprecated in /in/EX0K4 on line 9
Deprecated: Creation of dynamic property Person::$geslacht is deprecated in /in/EX0K4 on line 10
Fatal error: Uncaught Error: Undefined constant "geslacht" in /in/EX0K4:14
Stack trace:
#0 /in/EX0K4(18): Person->greet()
#1 {main}
thrown in /in/EX0K4 on line 14
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Deprecated: Creation of dynamic property Person::$firstname is deprecated in /in/EX0K4 on line 8
Deprecated: Creation of dynamic property Person::$leeftijd is deprecated in /in/EX0K4 on line 9
Deprecated: Creation of dynamic property Person::$geslacht is deprecated in /in/EX0K4 on line 10
Fatal error: Uncaught Error: Undefined constant "geslacht" in /in/EX0K4:14
Stack trace:
#0 /in/EX0K4(18): Person->greet()
#1 {main}
thrown in /in/EX0K4 on line 14
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught Error: Undefined constant "geslacht" in /in/EX0K4:14
Stack trace:
#0 /in/EX0K4(18): Person->greet()
#1 {main}
thrown in /in/EX0K4 on line 14
Process exited with code 255.