A
A
Anastasia2020-04-19 01:43:09
PHP
Anastasia, 2020-04-19 01:43:09

How to iterate over array_diff?

Hello. Looks like a very dumb question, but I'm stuck.
I have two arrays and I compare them.
My arrays look like this: And if I have differences in array_diff, then it returns conditionally: And how can I get the values ​​now? After all, result[0] will return false to me. Only result[12] and result[25] will display to me. And now, if I iterate through for, then conditionally I have 2 elements (count($result)), but they have numbers not 0 and 1, so for returns empty results to me.
[0 => "информация1", 1 => "информация2"...]
[12 => "информация12", 25 => "информация25"]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Samsonov, 2020-04-19
@nastya97core

Use foreach https://www.php.net/manual/ru/control-structures.f...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question