tags:

views:

74

answers:

2

If "Invalid argument supplied for foreach()" is a "warning" in PHP and doesn't halt execution, where does the script execution continue from? After the foreach block? After the function? What happens next?

+1  A: 

It continues after the foreach.

Jan Hančič
A: 

If I remember it correctly, PHP runs the loop with an empty array because that is the result of the dynamic type cast from "not an array" into "array".

So basically, it will skip the loop while wasting a little bit of CPU time. Effectively nothing happens.

Techpriester