-1
How can I search for the key value of "item_a" and return all the key values of "valor_a" in the array below? Example: I want to search by item_a = 3 and return the values 396, 1514 and 2106.
array (size=6)
0 =>
array (size=2)
'item_a' => string '3' (length=1)
'valor_a' => string '396' (length=3)
1 =>
array (size=2)
'item_a' => string '3' (length=1)
'valor_a' => string '1514' (length=4)
2 =>
array (size=2)
'item_a' => string '3' (length=1)
'valor_a' => string '2106' (length=4)
3 =>
array (size=2)
'item_a' => string '6' (length=1)
'valor_a' => string '1020' (length=4)
4 =>
array (size=2)
'item_a' => string '4' (length=1)
'valor_a' => string '1319' (length=4)
5 =>
array (size=2)
'item_a' => string '11' (length=2)
'valor_a' => string '1912' (length=4)
Just go through the main array, check if the key exists and join the elements in a new array.
– Isac
Do not use greetings or greetings, see what kind of behavior is expected from users?
– gleisin-dev