Skip to content

Instantly share code, notes, and snippets.

@gh-o-st
Last active July 26, 2021 06:56
Show Gist options
  • Select an option

  • Save gh-o-st/18325054388b56196c3e7fb168a05f25 to your computer and use it in GitHub Desktop.

Select an option

Save gh-o-st/18325054388b56196c3e7fb168a05f25 to your computer and use it in GitHub Desktop.
Just a quick n' dirty recursive version of array_key_exists()
<?php
function array_key_exists_r($array, $keySearch) {
if (is_array($array)) {
foreach ($array as $key => $item) {
return ($key == $keySearch) ? true : (array_key_exists_r($item, $keySearch)) ? true : false;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment