3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = 1; $b = 2; $x = [1, 2]; file_put_contents('/tmp/a.php', ''); class Foo { public $a = 1; public static $b = 3; function bar() {} static function baz() {} } 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 = Foo::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; // Was invalid inside a function but valid outside static $propertyFetch = (new Foo())->a; // works when not in a function static $nullsafePropertyFetch = (new Foo())?->a; // works when not in a function // Fatal errors in PHP 8.2 for each statement below static $arrowFunction = fn() => 1; static $assign = ($a = 1); static $assignOpAnd = ($a &= 1); static $assignOpConcat = ($a .= "b"); static $assignOpDiv = ($b /= 2); static $assignRef = ($a =& $b); static $castInt = (int)"1"; static $clone = clone (new stdClass()); static $closure = function () { return 1; }; static $closureUse = function () use ($x) {}; static $empty = empty(1); static $encapsed = "Value: $a"; static $errorSuppress = @new stdClass(); static $eval = eval('1+1;'); static $funcCall = strlen('x'); static $include = include '/tmp/a.php'; static $instanceof = new stdClass() instanceof Foo; static $isset = isset($x); static $list = [[$a, $b] = [1, 2]]; static $match = match (1) {1 => 'a', default => 'b'}; static $methodCall = (new Foo())->bar(); static $nullsafeMethodCall = (new Foo())?->bar(); static $postInc = $a++; static $print = print ''; static $shellExec = `whoami`; // expected warning due to sandbox environment static $staticCall = Foo::baz(); static $staticPropertyFetch = Foo::$b; static $variable = $a;

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.10.0080.01216.95
8.5.00.0090.01422.98
8.4.160.0160.00523.32
8.4.150.0090.00717.05
8.4.140.0340.00917.84
8.4.130.0340.01117.88
8.4.120.0440.00517.81
8.4.110.0340.01017.99
8.4.100.0390.01017.79
8.4.90.0380.01017.75
8.4.80.0380.00817.64
8.4.70.0360.01217.86
8.4.60.0420.01017.89
8.4.50.0370.01017.93
8.4.40.0370.01117.76
8.4.30.0390.01017.53
8.4.20.0410.00917.69
8.4.10.0390.00917.60
8.3.290.0120.00920.92
8.3.280.0120.00918.75
8.3.270.0350.00816.79
8.3.260.0370.00716.92
8.3.250.0340.01016.69
8.3.240.0350.01016.75
8.3.230.0360.00816.81
8.3.220.0340.00916.88
8.3.210.0350.01116.69
8.3.200.0360.00816.90
8.3.190.0350.00916.80
8.3.180.0360.00816.72
8.3.170.0400.00916.44
8.3.160.0380.00916.75
8.3.150.0400.00716.89
8.3.140.0410.00916.60
8.3.130.0330.01016.64
8.3.120.0360.00716.49
8.3.110.0310.01016.79
8.3.100.0380.01316.70
8.3.90.0390.00816.53
8.3.80.0400.00916.71
8.3.70.0400.00816.89
8.3.60.0360.01016.69
8.3.50.0390.00816.70
8.3.40.0380.01117.64
8.3.30.0270.01117.42
8.3.20.0310.00717.49
8.3.10.0320.00717.46
8.3.00.0290.01017.71
8.2.300.0110.01020.31
8.2.290.0320.00416.38
8.2.280.0290.00816.52
8.2.270.0350.00716.31
8.2.260.0310.00916.58
8.2.250.0340.00716.42
8.2.240.0300.01116.43
8.2.230.0290.01116.39
8.2.220.0290.00916.34
8.2.210.0310.00716.36
8.2.200.0300.00916.52
8.2.190.0330.00916.47
8.2.180.0320.00716.60
8.2.170.0320.00717.42
8.2.160.0310.00717.27
8.2.150.0320.00717.23
8.2.140.0320.00817.38
8.2.130.0320.00717.30
8.2.120.0320.00917.31
8.2.110.0320.00817.36
8.2.100.0300.00917.26
8.2.90.0300.00917.26
8.2.80.0290.01017.16
8.2.70.0330.00717.17
8.2.60.0330.00717.37
8.2.50.0290.01017.28
8.2.40.0320.00617.12
8.2.30.0270.01117.22
8.2.20.0330.00517.19
8.2.10.0290.00916.97
8.2.00.0370.00817.23
8.1.340.0110.00817.52

preferences:
39.28 ms | 403 KiB | 5 Q