PHP Arrays: Loop trough array with a lot of conditional statements. Help / Best practices
- by Jonathan
Hi, I have a problem I don't know how to get it to work the best way.
I need to loop trough an array like the one below. I need to check if the [country] index is equal to a Spanish speaking country (lot of countries) and then get those [title] indexes of the correspondent country and check for duplicates.
The original array:
Array
(
[0] => Array
(
[title] => Jeux de pouvoir
[country] => France
)
[1] => Array
(
[title] => Los secretos del poder
[country] => Argentina
)
[2] => Array
(
[title] => Los secretos del poder
[country] => Mexico
)
[3] => Array
(
[title] => El poder secreto
[country] => Uruguay
)
)
To help you understand, the final result I need to get looks something like this:
Array (
[0] => Array
(
[title] => Los secretos del poder
[country] => Argetnina, Mexico
)
[1] => Array
(
[title] => El poder secreto
[country] => Uruguay
) )