3v4l.org

run code in 300+ PHP versions simultaneously
<?php function findANeedle(string $haystack, array $needles) { foreach ($needles as $needle) { if (str_contains($haystack, $needle)) { return $needle; } } return null; } function hasANeedle(string $haystack, array $needles): bool { foreach ($needles as $needle) { if (str_contains($haystack, $needle)) { return true; } } return false; } $haystack = 'food fighters'; $needles = ['bar', 'foo']; var_export(findANeedle($haystack, $needles)); echo "\n--\n"; var_export(hasANeedle($haystack, $needles));

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.4.130.0120.00817.94
8.4.120.0060.00524.19
8.4.110.0120.00722.30
8.4.100.0140.00718.85
8.4.90.0040.00418.85
8.4.80.0120.00720.42
8.4.70.0140.00917.75
8.4.60.0120.00918.77
8.4.50.0140.00718.80
8.4.40.0060.01317.56
8.4.30.0060.01218.84
8.4.20.0030.01619.39
8.4.10.0030.00619.58
8.3.260.0100.00916.54
8.3.250.0160.00218.64
8.3.240.0090.01016.98
8.3.230.0130.00516.37
8.3.220.0120.00620.66
8.3.210.0120.00618.54
8.3.200.0020.00716.52
8.3.190.0110.00917.28
8.3.180.0120.00716.93
8.3.170.0060.00919.04
8.3.160.0140.00417.33
8.3.150.0110.00716.97
8.3.140.0070.01116.72
8.3.130.0080.00018.23
8.3.120.0000.00820.56
8.3.110.0120.00316.63
8.3.100.0060.00316.59
8.3.90.0060.00326.77
8.3.80.0090.00018.30
8.3.70.0100.01318.30
8.3.60.0110.00418.60
8.3.50.0110.00416.32
8.3.40.0030.01719.69
8.3.30.0070.01319.14
8.3.20.0040.01421.94
8.3.10.0140.00021.85
8.3.00.0040.01119.01
8.2.290.0090.00920.16
8.2.280.0070.01118.67
8.2.270.0030.01417.08
8.2.260.0090.00918.13
8.2.250.0060.00318.39
8.2.240.0080.00017.14
8.2.230.0080.00020.94
8.2.220.0050.00524.06
8.2.210.0080.00026.77
8.2.200.0060.00318.54
8.2.190.0090.00618.29
8.2.180.0040.01116.38
8.2.170.0110.00419.13
8.2.160.0070.00719.97
8.2.150.0120.00619.20
8.2.140.0100.01720.52
8.2.130.0130.00320.53
8.2.120.0090.00619.39
8.2.110.0180.00419.27
8.2.100.0030.01519.24
8.2.90.0100.01018.82
8.2.80.0090.00619.30
8.2.70.0060.00918.76
8.2.60.0140.00319.02
8.2.50.0040.01119.15
8.2.40.0120.00618.68
8.2.30.0110.00418.83
8.2.20.0110.00418.66
8.2.10.0120.00318.74
8.2.00.0000.01518.83
8.1.330.0120.00622.00
8.1.320.0110.00815.96
8.1.310.0120.00318.41
8.1.300.0060.00316.13
8.1.290.0030.00630.84
8.1.280.0060.01025.92
8.1.270.0130.00322.20
8.1.260.0100.01021.98
8.1.250.0070.00722.02
8.1.240.0140.00718.57
8.1.230.0170.00318.49
8.1.220.0140.00319.01
8.1.210.0110.00418.38
8.1.200.0110.00318.68
8.1.190.0110.00318.63
8.1.180.0070.00718.42
8.1.170.0000.01418.68
8.1.160.0140.00018.66
8.1.150.0170.00318.76
8.1.140.0130.00718.77
8.1.130.0140.00018.87
8.1.120.0070.01018.62
8.1.110.0060.00918.55
8.1.100.0070.01719.86
8.1.90.0150.00318.67
8.1.80.0040.01219.81
8.1.70.0030.01218.75
8.1.60.0070.01118.67
8.1.50.0150.00318.59
8.1.40.0140.00018.68
8.1.30.0040.01118.85
8.1.20.0120.00319.97
8.1.10.0120.00318.68
8.1.00.0070.00718.57

preferences:
32.38 ms | 403 KiB | 5 Q