3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Pont { private const SURFACE_TEXT = 'Ce pont mesure %dm'; private float $longueur; private float $largeur; public function setLongueur(float $longueur): void { if ($longueur < 0) { trigger_error( 'La longueur est trop courte. (min 1)', E_USER_ERROR ); } $this->longueur = $longueur; } public function getLongueur(): float { return $this->longueur; } public function setLargeur(float $largeur): void { if ($largeur < 0) { trigger_error( 'La largeur est trop courte. (min 1)', E_USER_ERROR ); } $this->largeur = $largeur; } public function getLargeur(): float { return $this->largeur; } public function getSurface(): float { return $this->longueur * $this->largeur; } public function printSurface(): void { echo sprintf(self::SURFACE_TEXT, $this->getSurface()); } } $towerBridge = new Pont; $towerBridge->setLongueur(286.0); $towerBridge->setLargeur(15.0); $towerBridge->printSurface();
Output for git.master_jit, git.master, rfc.property-hooks
Ce pont mesure 4290m

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:
39.73 ms | 405 KiB | 5 Q