3v4l.org

run code in 300+ PHP versions simultaneously
<?php function arrpos(array $haystack, array $needle) { $len1 = count($haystack); $len2 = count($needle); if ($len2 > $len1) { return false; } for ($i = 0; $i <= $len1 - $len2; $i++) { if ($haystack[$i] === $needle[0]) { for ($j = 1; $j < $len2; $j++) { if ($haystack[$i + $j] !== $needle[$j]) { continue 2; } } return $i; } } return false; } $needle = [2,4]; var_dump(arrpos([1,2,3,4], $needle)); var_dump(arrpos([1,2,4,3], $needle)); var_dump(arrpos([1,2,2,4,3], $needle)); var_dump(arrpos([1,2,3,4,5], [2,3,4,5]));
Output for git.master, git.master_jit, rfc.property-hooks
bool(false) int(1) int(2) int(1)

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:
56.36 ms | 401 KiB | 8 Q