开发者

"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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜