3v4l.org

run code in 300+ PHP versions simultaneously
<?php // fastest $final = (object) ['a' => 1, 'b' => 2]; // 2nd fastest $array = []; $array['a'] = 1; $array['b'] = 2; $final = (object) $array; //slow $final = new stdClass(); $final->a = 1; $final->b = 2; //slowest class myStdClass extends stdClass { $function __construct($a, $b) { $this->a = $a; $this->b = $b; } } $final = new mystdclass(1, 2);
Output for git.master_jit, git.master, rfc.property-hooks
Parse error: syntax error, unexpected variable "$function", expecting "function" in /in/8n1Uh on line 19
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


preferences:
156.71 ms | 3260 KiB | 6 Q