3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=0); 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.0150.00416.45
8.3.120.0000.00818.89
8.3.110.0000.01220.94
8.3.100.0080.00024.06
8.3.90.0070.01126.77
8.3.80.0070.00416.75
8.3.70.0120.00316.63
8.3.60.0040.01116.63
8.3.50.0110.00718.32
8.3.40.0090.00618.67
8.3.30.0120.00318.84
8.3.20.0040.00424.18
8.3.10.0030.00524.66
8.3.00.0050.00326.16
8.2.250.0060.00318.35
8.2.240.0000.00817.14
8.2.230.0080.00022.58
8.2.220.0040.00437.54
8.2.210.0040.00426.77
8.2.200.0090.00016.63
8.2.190.0080.01116.63
8.2.180.0030.01625.92
8.2.170.0120.00319.09
8.2.160.0100.00322.96
8.2.150.0000.00725.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0060.00326.16
8.2.110.0060.00620.78
8.2.100.0100.00319.60
8.2.90.0040.00418.09
8.2.80.0000.00918.03
8.2.70.0030.00617.93
8.2.60.0030.00618.22
8.2.50.0000.00818.10
8.2.40.0000.00921.20
8.2.30.0040.00419.18
8.2.20.0000.00818.12
8.2.10.0000.00819.36
8.2.00.0000.00819.30
8.1.300.0100.00218.38
8.1.290.0060.00330.84
8.1.280.0040.01125.92
8.1.270.0070.00023.99
8.1.260.0050.00326.35
8.1.250.0000.00828.09
8.1.240.0060.00323.64
8.1.230.0030.00922.75
8.1.220.0030.00617.74
8.1.210.0060.00318.86
8.1.200.0080.00017.35
8.1.190.0090.00017.36
8.1.180.0060.00318.10
8.1.170.0000.00818.55
8.1.160.0080.00018.89
8.1.150.0000.00818.55
8.1.140.0060.00320.61
8.1.130.0030.00320.05
8.1.120.0060.00317.46
8.1.110.0000.00917.41
8.1.100.0040.00717.43
8.1.90.0000.00817.45
8.1.80.0040.00417.50
8.1.70.0000.00717.36
8.1.60.0060.00317.52
8.1.50.0000.00817.53
8.1.40.0080.00017.53
8.1.30.0030.00517.54
8.1.20.0030.00617.63
8.1.10.0060.00617.43
8.1.00.0040.00417.36
8.0.300.0000.00719.72
8.0.290.0050.00316.75
8.0.280.0070.00018.31
8.0.270.0070.00017.97
8.0.260.0000.00618.49
8.0.250.0050.00316.99
8.0.240.0030.00317.00
8.0.230.0000.00717.00
8.0.220.0040.00416.93
8.0.210.0000.00716.87
8.0.200.0050.00317.03
8.0.190.0030.00617.05
8.0.180.0050.00316.94
8.0.170.0060.00316.98
8.0.160.0090.00017.01
8.0.150.0040.00416.91
8.0.140.0050.00516.82
8.0.130.0060.00013.39
8.0.120.0040.00416.84
8.0.110.0040.00416.93
8.0.100.0000.00716.77
8.0.90.0030.00516.96
8.0.80.0090.00916.86
8.0.70.0060.00316.93
8.0.60.0040.00416.98
8.0.50.0030.00716.98
8.0.30.0160.01216.92
8.0.20.0150.01516.84
8.0.10.0200.00716.89
8.0.00.0260.00416.94
7.4.330.0000.00615.55
7.4.320.0030.00316.55
7.4.300.0050.00216.59
7.4.290.0040.00716.54
7.4.280.0040.00416.58
7.4.270.0030.00316.59
7.4.260.0000.00613.23
7.4.250.0020.00516.57
7.4.240.0050.00216.62
7.4.230.0070.00016.43
7.4.220.0040.00416.52
7.4.210.0070.01216.55
7.4.200.0040.00416.34
7.4.160.0170.01016.46
7.4.150.0230.00316.46
7.4.140.0170.00716.42
7.4.130.0100.01416.46
7.4.120.0280.00316.38
7.4.110.0150.00916.20
7.4.100.0220.01216.34
7.4.90.0150.01516.39
7.4.80.0230.00716.45
7.4.70.0190.00616.36
7.4.60.0210.00716.36
7.4.50.0210.00416.32
7.4.40.0220.00416.37
7.4.30.0250.00316.26
7.4.20.0140.01116.40
7.4.10.0170.01116.38
7.4.00.0080.01916.43
7.3.330.0080.00016.48
7.3.320.0060.00013.40
7.3.310.0000.00716.32
7.3.300.0070.00016.34
7.3.290.0040.00416.38
7.3.280.0140.01216.37
7.3.270.0220.00416.27
7.3.260.0090.01516.38
7.3.250.0220.00416.43
7.3.240.0150.01116.36
7.3.230.0200.00816.32
7.3.220.0230.00716.40
7.3.210.0190.00916.25
7.3.200.0180.00916.22
7.3.190.0200.01316.29
7.3.180.0210.00716.33
7.3.170.0230.00416.30
7.3.160.0140.01716.29
7.3.150.0110.02116.29
7.3.140.0270.00016.30
7.3.130.0210.00616.30
7.3.120.0220.01316.22
7.3.110.0280.00716.21
7.3.100.0220.00316.25
7.3.90.0280.00716.48
7.3.80.0270.00316.28
7.3.70.0200.00816.34
7.3.60.0170.01716.39
7.3.50.0250.00616.38
7.3.40.0240.00516.37
7.3.30.0290.00516.43
7.3.20.0210.01416.39
7.3.10.0310.00716.36
7.3.00.0260.00416.36

preferences:
26.91 ms | 403 KiB | 5 Q