Easy
What will this code display?
<?php
class MyAwesomeClass
{
public function __construct(public string|null $name = null){}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
}
echo (new MyAwesomeClass())->setName('My awesome name')->name;
Author: JérômeStatus: PublishedQuestion passed 41 times
Edit
Similar QuestionsMore questions about PHP