3v4l.org

run code in 500+ PHP versions simultaneously
<?php function twig_compare($a, $b) { // int <=> string if (\is_int($a) && \is_string($b)) { $trimmed_b = trim($b, " \t\n\r\v\f"); if (!is_numeric($trimmed_b)) { return (string) $a <=> $b; } if ((int) $trimmed_b == $trimmed_b) { return $a <=> (int) $trimmed_b; } else { return (float) $a <=> (float) $trimmed_b; } } throw new \LogicException('partial implementation for quick test'); } $failures = []; foreach ([ [1, 42, ' foo'], [0, 42, "42\f"], [1, 42, "\x00\x34\x32"], ] as [$expected, $a, $b]) { $actual = twig_compare($a, $b); if ($expected === $actual) { echo '.'; } else { echo 'F'; $failures[] = [$a, $b, $expected, $actual]; } } echo "\n"; if (!$failures) { echo "OK\n"; } else { echo count($failures)." test(s) failed:\n"; foreach ($failures as [$a, $b, $expected, $actual]) { echo '('.var_export($a, true).', '.var_export($b, true)."): expected $expected, actual $actual\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.80.0040.00516.91
8.5.70.0070.00316.73
8.5.60.0090.00816.86
8.5.50.0100.00816.62
8.5.30.0080.00917.68
8.5.20.0080.00721.95
8.5.10.0110.00716.81
8.5.00.0140.00819.93
8.4.230.0140.00619.55
8.4.220.0160.00621.39
8.4.210.0120.00919.47
8.4.180.0100.01222.07
8.4.170.0120.00923.95
8.4.160.0120.00923.90
8.4.150.0060.00616.88
8.4.140.0120.01117.55
8.4.130.0160.00517.78
8.4.120.0130.00720.84
8.4.110.0140.00522.52
8.4.100.0140.00717.70
8.4.90.0060.00417.63
8.4.80.0020.00717.91
8.4.70.0140.00717.71
8.4.60.0100.01018.57
8.4.50.0120.00522.66
8.4.40.0090.00019.39
8.4.30.0080.00818.57
8.4.20.0070.01418.00
8.4.10.0100.00719.46
8.3.320.0140.00718.62
8.3.310.0130.00720.16
8.3.300.0110.01020.92
8.3.290.0060.00320.69
8.3.280.0110.01018.64
8.3.270.0130.00916.55
8.3.260.0130.00816.63
8.3.250.0050.00318.68
8.3.240.0040.00416.61
8.3.230.0090.00816.55
8.3.220.0080.00118.94
8.3.210.0080.00716.68
8.3.200.0060.00316.65
8.3.190.0040.00417.36
8.3.180.0090.01116.62
8.3.170.0110.00717.16
8.3.160.0090.00916.49
8.3.150.0150.00420.63
8.3.140.0040.00416.48
8.3.130.0040.00418.39
8.3.120.0040.00418.95
8.3.110.0060.00320.94
8.3.100.0110.00024.06
8.3.90.0080.00026.77
8.3.80.0030.00719.36
8.3.70.0070.01416.58
8.3.60.0030.01716.73
8.3.50.0070.01023.66
8.3.40.0120.00820.29
8.3.30.0110.00418.80
8.3.20.0020.00524.18
8.3.10.0000.00824.66
8.3.00.0060.00326.16
8.2.320.0090.01018.07
8.2.310.0120.00718.06
8.2.300.0150.00418.70
8.2.290.0090.01020.21
8.2.280.0130.00618.16
8.2.270.0110.00716.58
8.2.260.0110.00720.89
8.2.250.0040.00416.82
8.2.240.0040.00419.07
8.2.230.0060.00322.58
8.2.220.0000.00937.54
8.2.210.0120.00626.77
8.2.200.0050.00518.88
8.2.190.0070.01416.75
8.2.180.0100.00625.92
8.2.170.0070.00718.78
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00726.35
8.2.110.0060.00319.27
8.2.100.0070.00417.78
8.2.90.0040.00418.34
8.2.80.0070.00319.23
8.2.70.0000.00817.63
8.2.60.0060.00317.38
8.2.50.0000.00818.05
8.2.40.0050.00320.00
8.2.30.0050.00218.05
8.2.20.0040.00418.24
8.2.10.0000.00719.36
8.2.00.0000.00719.43
8.1.340.0140.00721.47
8.1.330.0110.00818.38
8.1.320.0120.00916.20
8.1.310.0110.00716.43
8.1.300.0060.00316.26
8.1.290.0000.00830.84
8.1.280.0110.00425.92
8.1.270.0040.00423.99
8.1.260.0070.00028.09
8.1.250.0050.00228.09
8.1.240.0080.00422.13
8.1.230.0120.00020.85
8.1.220.0000.00917.74
8.1.210.0040.00418.94
8.1.200.0040.00417.41
8.1.190.0000.00817.35
8.1.180.0030.00618.10
8.1.170.0000.00818.71
8.1.160.0060.00318.95
8.1.150.0050.00318.82
8.1.140.0040.00418.77
8.1.130.0000.00720.14
8.1.120.0020.00517.50
8.1.110.0050.00317.41
8.1.100.0040.00417.36
8.1.90.0000.01017.44
8.1.80.0050.00317.52
8.1.70.0030.00317.45
8.1.60.0050.00517.48
8.1.50.0030.00617.60
8.1.40.0000.00817.55
8.1.30.0080.00017.61
8.1.20.0000.00817.68
8.1.10.0040.00417.55
8.1.00.0000.00717.45
8.0.300.0000.00719.89
8.0.290.0040.00416.63
8.0.280.0030.00318.38
8.0.270.0000.00717.91
8.0.260.0030.00320.13
8.0.250.0030.00516.98
8.0.240.0030.00316.97
8.0.230.0040.00416.84
8.0.220.0000.00716.80
8.0.210.0000.00716.94
8.0.200.0030.00316.84
8.0.190.0000.00716.86
8.0.180.0040.00416.85
8.0.170.0000.00816.96
8.0.160.0040.00416.86
8.0.150.0050.00216.82
8.0.140.0040.00416.85
8.0.130.0000.00513.37
8.0.120.0060.00316.87
8.0.110.0040.00416.68
8.0.100.0000.00716.78
8.0.90.0080.00016.79
8.0.80.0070.01016.89
8.0.70.0000.00716.97
8.0.60.0000.00716.77
8.0.50.0000.00716.97
8.0.30.0130.00416.98
8.0.20.0030.01316.98
8.0.10.0050.00316.88
8.0.00.0090.00916.62
7.4.330.0000.00515.55
7.4.320.0030.00616.60
7.4.300.0040.00416.66
7.4.290.0070.00016.51
7.4.280.0020.00516.64
7.4.270.0050.00216.54
7.4.260.0000.00813.34
7.4.250.0030.00316.47
7.4.240.0020.00516.55
7.4.230.0030.00616.50
7.4.220.0000.00716.55
7.4.210.0060.00916.60
7.4.200.0030.00316.73
7.4.130.0070.01316.48
7.4.120.0160.00616.51
7.4.110.0080.01416.48
7.4.100.0070.01016.42
7.4.90.0060.01316.43
7.4.80.0100.00719.39
7.4.70.0160.00016.53
7.4.60.0080.00816.30
7.4.50.0110.00516.24
7.4.40.0080.00816.53
7.4.30.0070.01116.41
7.4.20.0120.00416.24
7.4.10.0120.00916.67
7.4.00.0000.01616.58
7.3.330.0000.00716.40
7.3.320.0030.00313.11
7.3.310.0000.00816.43
7.3.300.0020.00516.43
7.3.290.0080.01016.35
7.3.280.0060.00916.35
7.3.260.0130.01016.56
7.3.230.0110.00716.42
7.3.210.0100.00716.71
7.3.200.0060.00916.68
7.3.190.0060.01016.64
7.3.180.0130.00416.47
7.3.170.0100.00616.39
7.3.160.0130.00716.47
7.3.150.0040.01316.39
7.3.140.0150.00816.34
7.3.130.0060.01716.50
7.3.120.0040.01216.52
7.3.110.0110.00616.22
7.3.100.0130.00316.55
7.3.90.0000.01816.39
7.3.80.0060.01016.46
7.3.70.0100.00716.36
7.3.60.0070.01016.32
7.3.50.0140.00716.55
7.3.40.0180.00316.32
7.3.30.0120.00916.32
7.3.20.0150.00316.44
7.3.10.0090.00816.39
7.3.00.0060.01516.43
7.2.330.0060.01016.55
7.2.310.0070.01016.77
7.2.300.0030.01316.75
7.2.290.0130.00316.47
7.2.280.0140.00316.70
7.2.270.0090.00616.44
7.2.260.0130.00316.56
7.2.250.0130.00716.77
7.2.240.0110.00716.77
7.2.230.0030.01316.77
7.2.220.0040.01216.39
7.2.210.0130.00716.48
7.2.200.0130.00416.66
7.2.190.0150.00316.53
7.2.180.0120.01216.75
7.2.170.0070.01416.71
7.2.160.0150.00316.44
7.2.150.0060.01316.71
7.2.140.0090.00916.54
7.2.130.0080.00816.56
7.2.120.0030.01416.58
7.2.110.0070.01016.67
7.2.100.0090.00916.73
7.2.90.0090.01116.63
7.2.80.0140.00316.50
7.2.70.0070.01316.74
7.2.60.0030.01416.69
7.2.50.0160.00816.63
7.2.40.0100.00716.64
7.2.30.0170.00716.66
7.2.20.0160.00816.66
7.2.10.0120.01216.71
7.2.00.0220.01316.74

preferences:
114.96 ms | 1510 KiB | 5 Q