From: ben at umingo dot de Operating system: Windows PHP version: 5.2.6 PHP Bug Type: Feature/Change Request Bug description: Make C-Like Macros for PHP
Description: ------------ Hello people, i want to ask you for macros for PHP. Main purpose is to switch projects between testing, developing and production state without performance penalties. All these runtime if's could be skipped and that is jsut one example. It just gives you some more options I really miss macros from C and C++ days ... another useful example is for logging, I dont want to write a __LINE__ and __FILE__ everytime i log something. It would be much nicer to use a macro that will expand my logfunction with these parameters before compiling ... you know what i mean The bigger the project the bigger the effect of compiling times and execution times ... This could really be a speedup and at all nobody is forced to use macros. (in case php scripts are cached and precompiled) Reproduce code: --------------- //projectstate //0 testing //1 developing //2 production #define projectstate = 0 //some code ... #if projectstate == 0 //write some log, some output or whatever } #endif //some other code Expected result: ---------------- With macros, the code would be just //some code ... //some other code... Actual result: -------------- Without macros, the code would be //some code //an if-querry for projectstate //some hundred lines of code to parse and evaluate //endif //some other code -- Edit bug report at http://bugs.php.net/?id=46017&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46017&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46017&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46017&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46017&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46017&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46017&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46017&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46017&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46017&r=support Expected behavior: http://bugs.php.net/fix.php?id=46017&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46017&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46017&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46017&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46017&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46017&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46017&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46017&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46017&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46017&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46017&r=mysqlcfg