Created
January 10, 2017 20:59
-
-
Save mdahlke/5d8d452d8258136b70b0744da35f7a87 to your computer and use it in GitHub Desktop.
Implode an associative array on specified key
This file contains hidden or 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
function implode_aa( $glue, $array, $key ) { | |
$keep = array(); | |
foreach ( $array as $firstKey ) { | |
foreach ( $firstKey as $k => $v ) { | |
if ( $k === $key ) { | |
$keep[] = $v; | |
} | |
} | |
} | |
return implode( $glue, $keep ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment