3v4l.org

run code in 300+ PHP versions simultaneously
<?php class gardenObject implements JsonSerializable { public function jsonSerialize() { $data[] = $this->flowers; $data[] = $this->fruit; return $data; } } $garden = new gardenObject(); $garden->flowers = array("clematis", "geranium", "hydrangea"); $garden->herbs = array("mint", "sage", "chives", "rosemary"); $garden->fruit = array("apple", "rhubarb"); echo json_encode($garden);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of gardenObject::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Vg3k9 on line 4 Deprecated: Creation of dynamic property gardenObject::$flowers is deprecated in /in/Vg3k9 on line 11 Deprecated: Creation of dynamic property gardenObject::$herbs is deprecated in /in/Vg3k9 on line 12 Deprecated: Creation of dynamic property gardenObject::$fruit is deprecated in /in/Vg3k9 on line 13 [["clematis","geranium","hydrangea"],["apple","rhubarb"]]

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.08 ms | 402 KiB | 8 Q