Skip to content

Commit

Permalink
improved array functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sauls committed Feb 7, 2018
1 parent 785b16d commit 3a1f24c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/array.php
Expand Up @@ -91,15 +91,15 @@ function array_get_value($array, $key, $default = null)
}

if (\is_array($array)) {
return isset_array_key_or_key_exists($array, $key) ? $array[$key] : $default;
return get_array_value_or_fallback_to_default($array, $key, $default);
}

return $default;
}

function isset_array_key_or_key_exists($array, $key): bool
function get_array_value_or_fallback_to_default($array, $key, $default)
{
return (isset($array[$key]) || \array_key_exists($key, $array));
return (isset($array[$key]) || \array_key_exists($key, $array)) ? $array[$key] : $default;
}

function is_array_and_key_exists($array, $key): bool
Expand Down

0 comments on commit 3a1f24c

Please sign in to comment.