|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46821 include of same file is re-access and re-compiled each time within same script
Submitted: 2008-12-10 12:46 UTC Modified: 2008-12-15 21:32 UTC
From: php at pk dot freesurf dot fr Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 5.2.8 OS: linux
Private report: No CVE-ID: None
 [2008-12-10 12:46 UTC] php at pk dot freesurf dot fr
include "foo.php" within a loop is re-accessed & re-compile before execution each time...

php already knows that the file has been included (include_once generates an error), but does not remember the code within...

for source code clarity, has there is no macro-processor like in C, it is very usefull to use the include statement...

a function call is not appropriate in every case, as local variable scope can be a problem...
if there are 20 or more variable to be accessed, code will be not clear if they are part of function arguments,
neither the code will be clear if all variables are declared global.

so it is really an issue for me...

Reproduce code:
for ($i=0;$i<10000;++$i)
include "foo.php";

foo.php : hundreds of code lines

when content of foo.php is pasted inside the loop, execution time dramasticaly shorter..


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-10 15:19 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

 [2008-12-15 19:19 UTC] php at pk dot freesurf dot fr
of course it is not a bug, but it is a performance problem, that can be solved easyly...
 [2008-12-15 21:32 UTC]
APC provides this functionality and there is no intention to add this at the moment.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 07:01:34 2024 UTC