"Invalid argument supplied for foreach()" - What happens next?
If "Invalid argument supplied for 开发者_JAVA百科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?
It continues after the foreach.
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.
精彩评论