I have an array that looks like this:
array(
\'abc\' => 0,
\'foo-bcd\' => 1,
\'foo-def\' => 1,
\'foo-xyz\' => 0,
// ...
)
This is how I would do it, though I can't give you a more efficient advice before understanding what you want to do with the values you get.
$search = "foo-";
$search_length = strlen($search);
foreach ($array as $key => $value) {
if (substr($key, 0, $search_length) == $search) {
...use the $value...
}
}