3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = [1234, 4321, 3421, 2134, 468]; $bar = 34; 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);
Output for git.master, git.master_jit
1234 3421 2134

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
44.17 ms | 711 KiB | 4 Q