3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isNumberPresentInArray($a, $b) { foreach($a as $v) { if (is_array($v)) { if (isNumberPresentInArray($v, $b)) { return true; } } elseif ($v == $b) { return true; } } return false; } $a = [1, 2, [3, 4, 5], [6, [7, 8], 8, 10]]; var_dump(isNumberPresentInArray($a, 10)); // bool(true); var_dump(isNumberPresentInArray($a, 2)); // bool(true); var_dump(isNumberPresentInArray($a, 14)); // bool(false); var_dump(isNumberPresentInArray($a, 1)); // bool(true);
Output for git.master, git.master_jit, rfc.property-hooks
bool(true) bool(true) bool(false) bool(true)

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:
168.04 ms | 405 KiB | 5 Q