From:             noah at missionecommerce dot com
Operating system: Linux
PHP version:      5.2.6
PHP Bug Type:     Feature/Change Request
Bug description:  php needs a compile-time include/require like #include

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

-- 
Edit bug report at http://bugs.php.net/?id=46189&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=46189&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=46189&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=46189&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=46189&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=46189&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=46189&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=46189&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=46189&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=46189&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=46189&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=46189&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=46189&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=46189&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=46189&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=46189&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=46189&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=46189&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=46189&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=46189&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=46189&r=mysqlcfg

Reply via email to