Otra opción es que uses
array_filter de forma recursiva.
Código PHP:
Ver original$array = [
0 =>
[
"timestamp" => "1337966810",
"category" =>
[
0 => "survey78399_",
1 => "transactional",
],
"event" => "delivered",
],
1 =>
[
"timestamp" => "1337966855",
"category" =>
[
0 => "survey78399",
1 => "transactional",
],
"event" => "spam",
],
2 =>
[
"timestamp" => "1337966899",
"category" =>
[
0 => "survey8888",
1 => "transactional",
],
"event" => "open",
],
3 =>
[
"timestamp" => "1337966899",
"category" => "survey78399",
"event" => "open",
]
];
$search = 'survey78399';
$callback = function($item) use (&$callback, &$search) {
}else {
return $item == $search;
}
};
print_r($filtered); // imprime solo key 1 y 3 del arreglo original /*
Array
(
[1] => Array
(
[timestamp] => 1337966855
[category] => Array
(
[0] => survey78399
[1] => transactional
)
[event] => spam
)
[3] => Array
(
[timestamp] => 1337966899
[category] => survey78399
[event] => open
)
)
*/
Te recomiendo que leas el manual ya que php cuenta con funciones muy útiles para trabajar con
arreglos