Msgstr "Use notification undefined constant", but constant should be defined

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?

+3
source share
2 answers

, , . IE: , $class->setMaxNameLength(); , .

+1

error_reporting(E_ALL); include("common.php");.

, - :

Warning: include(common.php) [function.include]: failed to open stream: No such file or directory in xxx

, , include_path, .

EDIT:

Suhosin, suhosin.executor.include.*.

+1

All Articles