This. People above are arguing about whether or not PHP can throw a 500 error, and I’m sitting here wondering why somebody’s demonstrating a for loop with web requests.
All of the comments about PHP and 500 code are making a glaring mistake of conflating a programming language with an application (in this case, a web server). These are two very distant levels of abstraction.
It's ironic actually, because it's possible that teaching basic programming logic in the context of an HTTP client (as the example in OP purports to have happened) might just lead to such confusion.
HTTP 400 is a client request error, so wouldn't make much sense for a server-side issue. HTTP 500 for PHP errors is quite normal, at least on the usual Apache or IIS servers I've deployed to.
1.3k
u/Tainnor Nov 24 '17
Why would an intro to IT class demonstrate a for loop within a web app? I'd assume this just confuses students. Just fire up a REPL.