There are three files: common.php, controller.php and user.php.
The common.php file looks like this:
<?php
define("MAXIMUM_NAME_LENGTH", 50);
?>
The controller.php file looks like this:
<?php
include("common.php");
include("user.php");
$user = new user();
?>
The user.php file looks like this:
<?php
class user{
private $var = MAXIMUM_NAME_LENGTH;
}
?>
When the script is executed, a notification appears: Note: using undefined constant MAXIMUM_NAME_LENGTH - it is assumed that "MAXIMUM_NAME_LENGTH" is in /.../controller.php on line xxx. I want to share specific values ββin common.php between other files. How to do it properly?
scdmb source
share