Created
March 3, 2014 16:58
-
-
Save illucent/9329392 to your computer and use it in GitHub Desktop.
regex php for comma
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
| // loop through posts, populating $departments arrays | |
| foreach($posts as $post) { | |
| $deps = strip_tags( get_post_meta( $post->ID, '_cmb_department_text', TRUE )); | |
| preg_match_all("/,\s*/", $deps, $matches ); | |
| $result = array_combine($matches[1], $matches[2]); | |
| $departments[$result][] = $post; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment