How to iterate array_diff?

Hello. The hike is very stupid question, but I'm frozen.
I have two arrays and I compare them.
The arrays are of my view:
[0 => "информация1", 1 => "informationit is possible for 2"...]
And if I have array_diff to find the differences, it returns a conditional:
[12 => "информация12", 25 => "информация25"]
How am I supposed to get values? Because result[0] will return me false. Only result[12] and result[25] will show me. And if I iterate using for conditionally I have 2 element (count($result)) but they have numbers 0 and 1, so for me returns empty results.
April 19th 20 at 12:47
1 answer
April 19th 20 at 12:49
Solution
thanks, but I managed myself to come up with an answer))) I just tests once spent there and walked around for foreach in speed, so I was like, "everything will be only use for". - mallory.Jenkins87 commented on April 19th 20 at 12:52
@mallory.Jenkins87what kind of tests? - Dorcas.Carroll commented on April 19th 20 at 12:55
@Dorcas.Carroll, timer. here is the one: shutterstock_93437077.jpg
doing foreach and measure, and then make for:
for ($i = 0, $size = count($array); $i < $size; ++$i) { 
...
}

and also measure.
spoiler
for will be faster.
- mallory.Jenkins87 commented on April 19th 20 at 12:58
@mallory.Jenkins87, Or not be. In many cases, foreach works several times faster for. But, if you are in the loop does not iterate a million values, then there is no difference at all. So the optimization is attempted for vs foreach is complete nonsense. Then tie with PHP and write on the assembler. Exactly ten clock cycles of CPU will win (but not sure). - Garland81 commented on April 19th 20 at 13:01

Find more questions by tags PHP