Skip to content

Instantly share code, notes, and snippets.

@akamola
Last active November 5, 2016 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akamola/64283d23c0e33441a6b37c6bb0a35366 to your computer and use it in GitHub Desktop.
Save akamola/64283d23c0e33441a6b37c6bb0a35366 to your computer and use it in GitHub Desktop.
PHP: Find all entries of an array whose keys starts with "barfoo-"
<?php
foreach ( $foobar as $key => $value ) {
if ( preg_match('/^barfoo-/', $key) ) {
// Array entries of $foobar whose keys starts with barfoo-
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment