3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Database {} $fns = [ function ($str) {}, function ($str ="hello") {}, function (string $str) {}, function (string $str = null) {}, function (?string $str) {}, function (?Database $db) {}, function (Database $db = new Database()) {}, function (string|null $str) {}, function (string $str = "hello") {}, function (?string $str = "hello") {}, function (string|int $str) {}, function (string|null $str = null) {}, function (string|null $str = "hello") {}, ]; echo "parameter\tallowsNull\tisOptional\tgetDefaultValue\tgetType\n"; foreach ($fns as $fn) { $param = (new ReflectionFunction($fn))->getParameters()[0]; echo substr($param->__toString(), 26, -2) . "\t" . json_encode($param->allowsNull()) . "\t" . json_encode($param->isOptional()) . "\t" . ($param->isDefaultValueAvailable() ? str_replace("\n", "", print_r($param->getDefaultValue(), true)) : "throws ReflectionException") . "\t" . ($param->getType() ? get_class($param->getType()) : "null") . "\n"; }

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.90.0130.00617.04
8.5.80.0100.00816.98
8.5.70.0060.00116.98
8.5.60.0100.00916.76
8.5.50.0110.00616.77
8.5.30.0100.00719.39
8.5.20.0080.01120.02
8.5.10.0120.00816.77
8.5.00.0120.00920.11
8.4.240.0100.00819.77
8.4.230.0120.01019.93
8.4.220.0110.01222.05
8.4.210.0140.00819.91
8.4.180.0160.00923.67
8.4.170.0090.01323.82
8.4.160.0160.01223.76
8.4.150.0080.00416.96
8.4.140.0140.00717.70
8.4.130.0060.00417.72
8.4.120.0060.00322.44
8.4.110.0100.01022.54
8.4.100.0160.00424.08
8.4.90.0110.00618.74
8.4.80.0050.00419.59
8.4.70.0060.00218.37
8.4.60.0110.01018.97
8.4.50.0110.01218.67
8.4.40.0170.00317.77
8.4.30.0130.00618.86
8.4.20.0240.00518.46
8.4.10.0080.00019.70
8.3.330.0120.00718.56
8.3.320.0100.01018.60
8.3.310.0150.00518.74
8.3.300.0090.01121.00
8.3.290.0150.00620.82
8.3.280.0120.00818.57
8.3.270.0100.01016.64
8.3.260.0150.00516.54
8.3.250.0130.00718.87
8.3.240.0110.00516.73
8.3.230.0130.00716.57
8.3.220.0110.00617.11
8.3.210.0100.00918.32
8.3.200.0050.00316.66
8.3.190.0040.00417.30
8.3.180.0110.00716.66
8.3.170.0040.01518.96
8.3.160.0100.00018.43
8.3.150.0120.00620.79
8.3.140.0050.00319.11
8.3.130.0070.00718.49
8.3.120.0040.00418.85
8.3.110.0050.00322.58
8.3.100.0000.00922.58
8.3.90.0090.00622.58
8.3.50.0090.00022.58
8.3.00.0110.00828.09
8.2.320.0130.00817.98
8.2.310.0110.00719.91
8.2.300.0110.01018.79
8.2.290.0130.00620.52
8.2.280.0080.00920.23
8.2.270.0030.01616.94
8.2.260.0100.00718.92
8.2.250.0000.00816.98
8.2.240.0130.00719.08
8.2.230.0000.00922.58
8.2.220.0040.00422.58
8.2.210.0080.00022.58
8.2.110.0080.00320.24
8.2.100.0020.00918.84
8.1.340.0120.01321.76
8.1.330.0080.01121.74
8.1.320.0120.00716.20
8.1.310.0070.00718.50
8.1.300.0060.00318.59
8.0.110.0100.00828.09
7.4.330.0200.00328.09
7.1.60.0180.00516.69
5.6.400.0080.07625.66
5.5.110.0220.00015.62
5.4.430.0130.00415.62

preferences:
81.9 ms | 893 KiB | 5 Q