Created
May 25, 2011 13:50
-
-
Save eddmann/991009 to your computer and use it in GitHub Desktop.
iterates through key-value array and returns array with defined keys values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* iterates through key-value array and returns array with defined keys values | |
* @var Array $array | |
String $key | |
* @return Array | |
*/ | |
function array_key_value($array, $key) { | |
$output = array(); | |
foreach($array as $a) | |
if (array_key_exists($key, $a)) | |
$output[] = $a[$key]; | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment