3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Expressions { public $a = 1; function foo() { // Examples based on php-parser expression types static $array = [1, 2, 3]; static $arrayDimFetch = [1,2][0]; static $arrayItem = ['a' => 1]; static $binaryBitwiseAnd = 1 & 2; static $binaryConcat = "a" . "b"; static $binaryIdentical = 1 === 1; static $binaryPlus = 1 + 2; static $binarySpaceship = 1 <=> 2; static $bitwiseNot = ~1; static $booleanAnd = 1 && 2; static $booleanNot = !false; static $classConstFetch = self::class; static $coalesce = 1 ?? 2; static $constFetch = PHP_EOL; static $new = new stdClass(); static $scalarFloat = 3.14; static $scalarInteger = 123; static $scalarMagicConst = __LINE__; static $scalarString = 'string'; static $ternary = true ? 1 : 2; static $unaryPlus = +1; } } $expr = new Expressions(); $expr->foo();
Output for git.master_jit, git.master

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.57 ms | 405 KiB | 5 Q