Question from the PHP8 test

What will this code display?

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 42 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!