PHP - Pull out array keys that have matching values?
Posted
by
MAZUMA
on Stack Overflow
See other posts from Stack Overflow
or by MAZUMA
Published on 2012-09-21T21:35:54Z
Indexed on
2012/09/21
21:37 UTC
Read the original article
Hit count: 142
Is there a way to look inside an array and pull out the keys that have keys with matching values? Questions like this have been asked, but I'm not finding anything conclusive.
So if my array looks like this
Array
(
[0] => Array
(
[title] => Title 1
[type] =>
[message] =>
)
[1] => Array
(
[title] => Title 2
[type] =>
[message] =>
)
[2] => Array
(
[title] => Title 3
[type] =>
[message] =>
)
[3] => Array
(
[title] => Title 2
[type] => Limited
[message] => 39
)
[4] => Array
(
[title] => Title 4
[type] => Offline
[message] => 41
)
[5] => Array
(
[title] => Title 5
[type] =>
[message] =>
)
And I want to get this
Array
(
[1] => Array
(
[title] => Title 2
[type] =>
[message] =>
)
[3] => Array
(
[title] => Title 2
[type] => Limited
[message] => 39
)
)
© Stack Overflow or respective owner