Comparison between foreach and while :-
Today we do one comparison between while and foreach to know that which one is more simple to be use .
Code for while:-While (($key = array_shift($b)) ! = = null))
Code for foreach:-Foreach($b as $key)
How to use:-
The foreach loop code execute about 8,000 times in 10 seconds while the while loop code execute about 6,000 times in 10 seconds.
So ,Inspite of:-
While (($key = array_shift($b)) ! = = null))
We can use
Foreach($b as $key)