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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.