3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = [1234, 4321, 3421, 2134, 468]; $bar = 21; function arithm_search($needle, $haystack) { $needle_length = floor(log10($needle)) + 1; $div = 10 ** $needle_length; foreach ($haystack as $val) { $tmp = $val; while ($tmp > 0) { if (floor($tmp % $div) == $needle) { echo $val . PHP_EOL; break; } $tmp = floor($tmp / 10); } } } arithm_search($bar, $foo);

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.30.0090.00919.69
8.5.20.0380.00516.48
8.5.10.0330.01116.72
8.5.00.0350.00516.73
8.4.180.0130.00919.68
8.4.170.0320.01019.75
8.4.160.0330.01119.54
8.4.150.0280.01319.64
8.4.140.0330.01217.84
8.4.130.0340.01217.75
8.4.120.0410.01117.94
8.4.110.0390.01217.67
8.4.100.0450.00917.80
8.4.90.0390.00717.89
8.4.80.0410.00517.80
8.4.70.0360.01117.98
8.4.60.0450.00717.95
8.4.50.0370.00917.95
8.4.40.0400.01417.58
8.4.30.0380.01117.68
8.4.20.0430.00617.67
8.4.10.0380.01117.63
8.3.300.0360.00918.63
8.3.290.0360.01018.53
8.3.280.0320.01418.43
8.3.270.0390.00916.51
8.3.260.0320.01016.69
8.3.250.0400.00816.71
8.3.240.0350.00916.80
8.3.230.0370.00916.73
8.3.220.0410.00516.83
8.3.210.0340.01316.58
8.3.200.0420.01316.82
8.3.190.0390.00716.99
8.3.180.0370.00916.77
8.3.170.0410.00516.43
8.3.160.0390.00816.77
8.3.150.0370.01116.68
8.3.140.0450.00916.82
8.3.130.0320.01016.59
8.3.120.0330.00416.74
8.3.110.0330.00816.47
8.3.100.0390.00916.83
8.3.90.0390.00816.55
8.3.80.0440.00516.56
8.3.70.0380.01116.43
8.3.60.0420.00916.50
8.3.50.0410.01116.78
8.3.40.0400.01017.75
8.3.30.0330.00517.95
8.3.20.0300.00917.93
8.3.10.0370.00817.93
8.3.00.0160.01017.91

preferences:
56.32 ms | 703 KiB | 6 Q