Possible Duplicate:
Pattern Match on a Array Key
I need to get all the elements in an array with a specific key pattern. For example in this array:
$items = array(
"a" => "1",
"b" => "2",
"special_1" => "3",
"c" => "4",
"special_2" => "5",
"special_3" => "6",
"d" => "7"
);
I would need all elements with a key containing the string special_
. These should define a new array:
$special_items = array(
"special_1" => "3",
"special_2" => "5",
"special_3" => "6",
);
Is there a smart method besides a while
loop?