From: slothman Date: Tue, 19 Feb 2008 19:48:53 +0000 (+0000) Subject: Modify pickKey to examine parent array before nested arrays. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f2b614f41dab9515a3ffcce1bcc5dad6532da6b0;p=s9y.git Modify pickKey to examine parent array before nested arrays. --- diff --git a/include/functions.inc.php b/include/functions.inc.php index 243546b..4571b40 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -1149,6 +1149,10 @@ function &serendipity_pickKey(&$array, $key, $default) { return $default; } + // array_key_exists() copies array, so is much slower. + if (in_array($key, array_keys($array))) { + return $array[$key]; + } foreach($array AS $child) { if (is_array($child) && isset($child[$key]) && !empty($child[$key])) { return $child[$key];