How does this work?

I thought I would download a package solution of a web application to see how other applications handle file paths. I downloaded phpbb and they have a file called common.php located in their project folder (in this case: phpbb)

in common.php they ahve this bit of code:

if (defined('IN_CRON')) 
{ 
    $phpbb_root_path = dirname(__FILE__) . DIRECTORY_SEPARATOR; 
}

In index.php they are using the $phpbb_root_path variable to include common.php.

How is this possible? If that variable is defined in common.php then how can they use it to include common.php itself?

variable values can, uh, vary.

Are you certain it isn’t being assigned a value elsewhere as well?