I tried many ways to define a constant based on another. Nothing comes out. Google and manuals didn’t help much either.

class Config { const PROJ_ROOT = "/srv/www/htdocs/inet_shop/admin"; const IMAGES_DIR = self::PROJ_ROOT . "/images"; // тут ошибка // ... } 

I run tests through the console and issue:

 PHP Parse error: syntax error, unexpected '.', expecting ',' or ';' in /srv/www/htdocs/inet_shop/admin/config.php on line 5 

Why?

  • five
    What version of php? For "Support for constant expressions was added in PHP 5.6.0.", The manual says, by the way. - u_mulder
  • @u_mulder 5.5.14 - OlegUP
  • See the message above. - u_mulder
  • @u_mulder Yes, it is already clear - OlegUP

0