Why don't you try ?
For instance, you could have a first file, called temp.php
, that contains this :
<?php
$a = my_func();
include 'temp-2.php';
function my_func() {
die;
}
And the second file, temp-2.php
, that would contain this :
<?php
sleep(5);
When you call temp.php
from your web-browser, how long does it take for the page to load ? It is almost instantaneous ? Or does it take 5 seconds ?
In the first case, the function is called before temp-2.php
is included.
... And, after trying : it does take only an instant -- which means the second file is not included, when there is a die or exit in the function.
EDIT after the comment : oh, sorry, I didn't really understand the question, I suppose :-(
Here is another try : the temp.php
still contains this :
<?php
$a = my_func();
include 'temp-2.php';
function my_func() {
die;
}
But the temp-2.php
file now contains only that :
<?php
,
Which, yes, will get you a parse error if PHP tries to parse this file.
If you call temp.php
from your problem, it doesn't seem to be any problem at all : nothing is displayed, and there is no parse error.
Now, if you comment the "die
" line inside the my_func
function, and try calling temp.php
again in your browser, you get :
Parse error: syntax error, unexpected ',' in /home/squale/developpement/tests/temp/temp-2.php on line 3
Which indicates there is a Parse error if PHP tries to parse that second file.
So, the first time, the function has been called before PHP actually tried to parse the second file.
Hope this answer you question better, this time :-)