|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-04-13 21:23 UTC] nikic@php.net
[2012-04-13 21:50 UTC] johannes@php.net
-Status: Open
+Status: Wont fix
-Package: Feature/Change Request
+Package: *General Issues
[2012-04-13 21:50 UTC] johannes@php.net
[2012-04-13 23:12 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 14:00:01 2025 UTC |
Description: ------------ Using include/require in a loop causes horrible preformance, because of the additional stat, file read, and opt-code compile on every loop iteration. PHP really needs a method to do compile-time includes/requires as well as the current run-time include/require. I would like to be able to do #include like in C and have the compiler insert the contents of the file into the script BEFORE compilation. This shouldn't be a complicated feature addition, and it would make life alot easier when developing with large projects with alot of reusable code. Reproduce code: --------------- for( $i = 0; $i < 1000; $i ++ ) { // I want run this code by including the file // But this code is not appropriate to make a function for // And its very long, so I dont just want to paste the code inside // this loop because it makes developement more confusing include '/www/some_code_snippet.php'; } Expected result: ---------------- Although I knew include was a run-time event, I was hoping behavior to #include in C. Actual result: -------------- Tracing the code, I found it produced 1000 file stats, 1000 file reads, and 1000 opt-code compiles