3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { public $prop1 = "I'm a class property!"; public function __construct() { echo 'The class "', __CLASS__, '" was initiated!<br />'; } public function __destruct() { echo 'The class "', __CLASS__, '" was destroyed.<br />'; } public function __toString() { echo "Using the toString method: "; return $this->getProperty(); } public function setProperty($newval) { $this->prop1 = $newval; } public function getProperty() { return $this->prop1 . "<br />"; } } // Create a new object $obj = new MyClass; // Output the object as a string echo $obj; // Destroy the object unset($obj); // Output a message at the end of the file echo "End of file.<br />"; ?>
Output for git.master, git.master_jit, rfc.property-hooks
The class "MyClass" was initiated!<br />Using the toString method: I'm a class property!<br />The class "MyClass" was destroyed.<br />End of file.<br />

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:
30.52 ms | 401 KiB | 8 Q