Created
April 16, 2013 14:49
-
-
Save paulhhowells/5396533 to your computer and use it in GitHub Desktop.
array_numbered_key_elements() Many Drupal 7 arrays mix numeric and associate keys, and you often need to separate the numerically keyed children from the associatively keyed arrays. This function returns an array containing only the numbered keys ready to be iterated through.
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
/* | |
* returns: an array containing only the numbered keys | |
* | |
* notes: array_intersect_key() is faster than array_intersect() | |
*/ | |
function array_numbered_key_elements($array) { | |
return array_intersect_key($array, element_children($array)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment