3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait AssignHandler { public function __call($name, $args) { if(preg_match("#^set([A-Z][a-zA-Z0-9_]+?)$#", $name, $matches)) { $property = strtolower($matches[1]); if(property_exists($this, $property)) { $this->{$property} = $args[0] ?? null; } } return $this; } } class Post { use AssignHandler; public $title; public $content; } $post = new Post; $post->setTitle("Value") ->setContent("example content"); print_r($post);
Output for git.master, git.master_jit, rfc.property-hooks
Post Object ( [title] => Value [content] => example content )

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