I see in many codes that programmers are a constant and in the document itself check if this constant exists (has been defined) in itself. I would like to know why this happens.
When we download the open platform from the phpBB3 platform, open the file install/database_update.php
, soon in the first lines we notice this:
if (defined('IN_PHPBB') && defined('IN_INSTALL'))
{
$updates_to_version = UPDATES_TO_VERSION;
$debug_from_version = DEBUG_FROM_VERSION;
$oldest_from_version = OLDEST_FROM_VERSION;
return;
}
define('IN_PHPBB', true);
define('IN_INSTALL', true);
In almost all the files found to be downloaded in the code of phpBB3
, there is this constant define('IN_PHPBB', true);
being defined at the beginning of the code.
This is the main example I can remember to elucidate my doubt ...
Based on this code (and some others I've seen, but I will not have my hand), is there any particular reason for this? Is it some kind of good safety practice?