0
Array A
[0] => stdClass Object
(
[id] => 1542
[id_restaurant] => 303
[name] => Café da Manhã
[hour] => 10:15:00
[quantity] => 10
[peoples] => 6
[weekday] => 1
[is_available] => 1
[created_at] => 2018-09-21 16:28:23
[updated_at] => 2018-09-21 16:28:23
)
[1] => stdClass Object
(
[id] => 1543
[id_restaurant] => 303
[name] => Almoço
[hour] => 16:00:00
[quantity] => 10
[peoples] => 6
[weekday] => 1
[is_available] => 1
[created_at] => 2018-09-21 16:28:23
[updated_at] => 2018-09-21 16:28:23
)
[2] => stdClass Object
(
[id] => 1544
[id_restaurant] => 303
[name] => Janta
[hour] => 17:45:00
[quantity] => 10
[peoples] => 6
[weekday] => 1
[is_available] => 1
[created_at] => 2018-09-21 16:28:23
[updated_at] => 2018-09-21 16:28:23
)
[3] => stdClass Object
(
[id] => 1545
[id_restaurant] => 303
[name] => Café da Manhã
[hour] => 10:45:00
[quantity] => 20
[peoples] => 6
[weekday] => 2
[is_available] => 1
[created_at] => 2018-09-21 16:28:23
[updated_at] => 2018-09-21 16:28:23
)
Array B
[0] => stdClass Object
(
[id] => 1540
[id_restaurant] => 303
[name] => Café da Manhã
[hour] => 10:15:00
[quantity] => 10
[peoples] => 6
[weekday] => 1
[is_available] => 1
[created_at] => 2018-09-21 16:28:23
[updated_at] => 2018-09-21 16:28:23
)
[1] => stdClass Object
(
[id] => 1599
[id_restaurant] => 303
[name] => Almoço
[hour] => 16:00:00
[quantity] => 10
[peoples] => 6
[weekday] => 1
[is_available] => 1
[created_at] => 2018-09-21 16:28:23
[updated_at] => 2018-09-21 16:28:23
)
[2] => stdClass Object
(
[id] => 1544
[id_restaurant] => 303
[name] => Janta
[hour] => 17:45:00
[quantity] => 10
[peoples] => 6
[weekday] => 1
[is_available] => 1
[created_at] => 2018-09-21 16:28:23
[updated_at] => 2018-09-21 16:28:23
)
[3] => stdClass Object
(
[id] => 1545
[id_restaurant] => 303
[name] => Café da Manhã
[hour] => 10:45:00
[quantity] => 20
[peoples] => 6
[weekday] => 2
[is_available] => 1
[created_at] => 2018-09-21 16:28:23
[updated_at] => 2018-09-21 16:28:23
)
I have 2 arrays A and B... I need to remove from both arrays the elements whose id are not in both arrays A and B ex: ids 1544 and 1545 exist in both arrays, the ones that do not exist need to be removed from both arrays.
Your question got confused, from what I understand, you want to remove from both
array
items that do not exist in botharray
. Assemble an example of the return you need and also put the code you’ve tried.– Roberto de Campos
ready now ta working.... had not noticed that you wanted to separate the ones that exist in the 2
– Willian
ae man validates the answer to anyone who needs to know which one was used
– Willian