3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function acceptBool(bool $x) {} function acceptInt(int $x) {} function acceptFloat(float $x) {} function acceptString(string $x) {} function acceptArray(array $x) {} function acceptObject(object $x) {} $functions = [ "bool" => "acceptBool", "int" => "acceptInt", "float" => "acceptFloat", "string" => "acceptString", "array" => "acceptArray", "object" => "acceptObject", ]; $vars = [ "null" => null, "bool" => true, "int" => 1, "float" => 3.14, "numeric string" => "2.72", "non-numeric string" => "elephphant", "array" => [1, 2, 3], "object" => new stdClass(), ]; foreach ($vars as $passedType => $var) { foreach ($functions as $acceptedType => $function) { if ($passedType === $acceptedType) { continue; } echo str_pad($passedType, 18) . " -> " . str_pad($acceptedType, 10) . ": "; try { $function($var); echo "success"; } catch(TypeError $e) { echo "failure"; } echo "\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.3.130.0030.00618.33
8.3.120.0100.01018.78
8.3.110.0030.00620.94
8.3.100.0030.00716.96
8.3.90.0090.00026.77
8.3.80.0060.00316.63
8.3.70.0150.00016.63
8.3.60.0090.00616.59
8.3.50.0150.00417.96
8.3.40.0090.00618.79
8.3.30.0120.00318.62
8.3.20.0080.00024.18
8.3.10.0000.00824.66
8.3.00.0000.00926.16
8.2.250.0040.00418.69
8.2.240.0030.00617.08
8.2.230.0180.00322.58
8.2.220.0040.00424.06
8.2.210.0040.00426.77
8.2.200.0030.00716.75
8.2.190.0040.01416.72
8.2.180.0130.00625.92
8.2.170.0130.00622.96
8.2.160.0100.00722.96
8.2.150.0070.00025.66
8.2.140.0070.00024.66
8.2.130.0000.00826.16
8.2.120.0090.00021.18
8.2.110.0090.00019.39
8.2.100.0030.00917.84
8.2.90.0050.00519.21
8.2.80.0000.00818.22
8.2.70.0060.00317.75
8.2.60.0000.00817.75
8.2.50.0050.00317.75
8.2.40.0040.00419.36
8.2.30.0030.00617.90
8.2.20.0020.00518.04
8.2.10.0050.00219.37
8.2.00.0040.00419.18
8.1.300.0090.00616.12
8.1.290.0030.00630.84
8.1.280.0070.01125.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0060.00328.09
8.1.240.0060.00321.43
8.1.230.0080.00417.83
8.1.220.0040.00417.74
8.1.210.0000.00918.77
8.1.200.0070.00317.35
8.1.190.0060.00317.41
8.1.180.0060.00318.10
8.1.170.0030.00517.62
8.1.160.0040.00418.93
8.1.150.0070.00018.88
8.1.140.0030.00620.71
8.1.130.0030.00320.19
8.1.120.0040.00417.46
8.1.110.0040.00417.38
8.1.100.0070.00317.36
8.1.90.0040.00417.46
8.1.80.0070.00317.49
8.1.70.0000.00817.34
8.1.60.0030.00617.57
8.1.50.0080.00017.41
8.1.40.0000.00817.42
8.1.30.0000.00817.54
8.1.20.0050.00317.57
8.1.10.0030.00717.45
8.1.00.0000.00917.52
8.0.300.0080.00018.77
8.0.290.0040.00416.63
8.0.280.0030.00318.61
8.0.270.0030.00517.98
8.0.260.0030.00318.48
8.0.250.0030.00317.02
8.0.240.0040.00416.98
8.0.230.0000.00717.03
8.0.220.0000.00716.96
8.0.210.0000.00716.97
8.0.200.0000.00716.93
8.0.190.0000.00916.98
8.0.180.0000.00916.84
8.0.170.0050.00316.97
8.0.160.0060.00316.95
8.0.150.0070.00016.90
8.0.140.0030.00716.78
8.0.130.0060.00013.42
8.0.120.0040.00416.84
8.0.110.0000.00816.96
8.0.100.0040.00416.91
8.0.90.0040.00416.80
8.0.80.0060.00916.91
8.0.70.0000.00816.80
8.0.60.0040.00416.84
8.0.50.0040.00417.02
8.0.30.0230.00916.93
8.0.20.0250.00816.91
8.0.10.0210.01417.07
8.0.00.0200.00817.02
7.4.330.0020.00215.55
7.4.320.0030.00316.50
7.4.300.0000.00716.57
7.4.290.0100.00016.44
7.4.280.0000.00716.48
7.4.270.0030.00316.61
7.4.260.0060.00013.27
7.4.250.0080.00016.61
7.4.240.0060.00216.53
7.4.230.0070.00016.60
7.4.220.0040.00416.66
7.4.210.0050.01416.60
7.4.200.0030.00316.63
7.4.160.0260.01216.60
7.4.150.0220.00816.38
7.4.140.0140.01116.32
7.4.130.0130.01316.46
7.4.120.0210.00516.32
7.4.110.0130.01316.39
7.4.100.0160.00816.49
7.4.90.0210.00416.35
7.4.80.0210.00916.46
7.4.70.0170.01016.46
7.4.60.0210.00516.48
7.4.50.0190.00616.49
7.4.40.0210.00516.41
7.4.30.0180.00916.31
7.4.20.0150.01116.39
7.4.10.0210.00616.45
7.4.00.0160.00916.43
7.3.330.0040.00416.46
7.3.320.0030.00313.43
7.3.310.0030.00416.25
7.3.300.0040.00416.45
7.3.290.0070.01216.39
7.3.280.0270.00016.24
7.3.270.0200.01016.29
7.3.260.0160.01616.34
7.3.250.0150.01116.34
7.3.240.0210.00616.40
7.3.230.0160.01016.36
7.3.220.0210.00716.30
7.3.210.0210.00916.29
7.3.200.0250.00716.28
7.3.190.0300.00316.32
7.3.180.0220.01116.24
7.3.170.0280.00916.32
7.3.160.0280.00316.32
7.3.150.0300.00716.25
7.3.140.0270.01016.31
7.3.130.0250.00616.32
7.3.120.0170.00816.24
7.3.110.0180.01116.23
7.3.100.0240.00316.24
7.3.90.0220.00516.54
7.3.80.0220.01116.27
7.3.70.0190.01316.31
7.3.60.0290.00916.48
7.3.50.0240.01216.38
7.3.40.0290.00016.41
7.3.30.0170.01016.27
7.3.20.0250.00816.35
7.3.10.0260.00516.30
7.3.00.0270.00616.36

preferences:
27.34 ms | 403 KiB | 5 Q