Question from the PHP8 test

PHP: How to use the readonly keyword

Medium

What will this code display?

<?php

readonly class ParameterInput
{
	public function __construct(
		public string $key,
		public mixed $value = null
		
	)
	{}
}

$myInput = new ParameterInput("myKey");

$myInput->value = "myValue";

echo $myInput->value;
Author: JérômeStatus: PublishedQuestion passed 103 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!