3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'A', 'B', 'C', 'D' => [ 'E', 'F' => [ 'G', 'H' ] ], 'I' => [ 'J', 'K' ], 'L' ]; function categoryExist($arr, $category) : bool { $ce = false; foreach ($arr as $key => $value) { if ($category === $key) return true; if (is_array($value)) { if (categoryExist($value, $category)) return true; } else { if ($category === $value) return true; } } return false; } foreach (range('A', 'M') as $cat) echo "Category '$cat' " . (categoryExist($arr, $cat) ? '' : 'not ') . "found\n"; ?>
Output for git.master, git.master_jit, rfc.property-hooks
Category 'A' found Category 'B' found Category 'C' found Category 'D' found Category 'E' found Category 'F' found Category 'G' found Category 'H' found Category 'I' found Category 'J' found Category 'K' found Category 'L' found Category 'M' not found

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:
147.27 ms | 406 KiB | 5 Q