<?php
class Person {
public $name;
public function __construct($name)
{
$this->name = $name;
}
public function name($name)
{
return $this->name;
}
}
$user = new Person;
var_dump($user->name('chris'));
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Person::__construct(), 0 passed in /in/Qv6Aq on line 19 and exactly 1 expected in /in/Qv6Aq:6
Stack trace:
#0 /in/Qv6Aq(19): Person->__construct()
#1 {main}
thrown in /in/Qv6Aq on line 6
Process exited with code 255.
Warning: Missing argument 1 for Person::__construct(), called in /in/Qv6Aq on line 19 and defined in /in/Qv6Aq on line 6
Notice: Undefined variable: name in /in/Qv6Aq on line 8
NULL