run code in 300+ PHP versions simultaneously
<?php class Tablier { public function __construct(public float $longueur, public float $largeur){ } } class Pont { private closure $taille = nullable; public function __sleep() { return array('name','tablier'); } public function __wakeup() { $this->taille = fn() => $this->tablier->longueur * $this->tablier->largeur; } public function __construct(protected string $name, protected Tablier $tablier) { $this->taille = fn() => $this->tablier->longueur * $this->tablier->largeur; } public function __clone(){ $this->tablier = clone $this->tablier; } } $pont1 = new Pont("towerBridge", new Tablier(386,16)); var_dump($pont1); $pont2 = clone $pont1; $chaine = serialise($pont1); echo $chaine; $pont3 = unserialise($chaine); var_dump($pont3);
Output for git.master, git.master_jit
Fatal error: Uncaught Error: Undefined constant "nullable" in /in/UjT6Q:30 Stack trace: #0 {main} thrown in /in/UjT6Q on line 30
Process exited with code 255.

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

12.31 ms | 459 KiB | 5 Q