If PHP is interpreted language(every line is executed as it is reached), how come it throws errors if the error occurs inside a function which is never executed?

Or may be I don't get what interpreted means?

For e.g


$number = 1;

function square(){

 $foo = 1  //missing semicolon, throws error

echo $number;


Accepted Answer

Because its syntax is first parsed in an attempt to tokenize it, before the PHP interpreter can begin.

Written by alex
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki