3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Pizza { public float $property1 = 9; // On set the temperature is set, so is property1 public float $temperature = 10 { get { return $this->temperature; } set (float $value) => $this->property1 = $value; } //Default value is ignored, makes sense but unexpected public float $temperature2 = 12 { get { return $this->temperature; } set (float $value) => $this->temperature = $value; } } $pizza = new Pizza(); var_dump($pizza->temperature); var_dump($pizza->temperature2); $pizza->temperature = 11; var_dump($pizza->temperature); var_dump($pizza->property1);
Output for git.master_jit, git.master
float(10) float(10) float(11) float(11)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
50.07 ms | 493 KiB | 3 Q