Imagine I have this constant in PHP:
define('APP_PATH', str_replace('//', '/', str_replace('\\', '/', dirname(__FILE__) . '/')));
When I use APP_PATH
in my application, does PHP execute the code (dirname
, and the two str_replace
on __FILE__
) each time or PHP execute the code once and store the result in APP_PATH
? I hope I'm clear enough :)
This question applies to PHP 5.1.0+.