Do dummy functions consume cycles, because of the expressions in their parameters, even though they are empty inside?
I have set FirePHP as my debugger and I am pretty happy with it. I have a couple of global functions, _d(), _g(), _u(), ( debug, group, ungroup - for closing groups) that I use throughout my code to get information about what is going on.
The debug.php file that is included in the beginning of each script, checks whether the application is residing in the development server, and declares these functions to output the info to FirePHP. If, on the other hand the application is running in the production server, the functions get declared, but as dummy functions:
function _d(){
//do nothing
}
This way I don't need to remove the debug function calls throughout my code before uploading to the production server.
I am concerned, however that the arguments passed to these functions might get evaluated anyway, resulting in unwanted and unneccessary overhead.
Does anyone know if this is the case? Is the PHP interpreter smart enough to see that since these arguments are not used in the function, they don't need to be evaluated, or does it go ahead and avaluate them anyway?
Posted Jul 10, 2012, 8:36 AM UTC