Example scenario:
echo hello();
echo '<br>';
echo 'Hello ' . world('World');
function hello() {
return 'World';
}
function world($v) {
return $v;
}
Output:
World
Hello World
How does PHP
process this?
About the example, we can conclude: echo
is before the method , so PHP does not read row by line sequentially , so if it was that way, it would not have read the method below to be able to resolve the current (correct) line!?
Questions:
-
It has been reading line by line and when positioning on a line that calls a method, it searches that method in every script and stores it in memory strong>, and only then back to solve where did it stop?
- Assuming that this is the way, when you finish fetching the method and resolving the line in position, it continues to read
script
following the next lines, and so on?
- Assuming that this is the way, when you finish fetching the method and resolving the line in position, it continues to read