1
namespace my;

const DHA=__NAMESPACE__."you are accessing constant";  //generate parse error

const DHA=__NAMESPACE__,"you are accessing constant";  //generate parse error

I tried concating using '.' and ',' but both it gives

Parse error: syntax error, unexpected '.', expecting ',' or ';'

EDIT (UPDATE) : This is a bug in PHP 5.5. It has been resolved in 5.6. https://wiki.php.net/rfc/const_scalar_exprs.

Dhairya Lakhera
  • 4,445
  • 3
  • 35
  • 62

1 Answers1

1

Which version of PHP

See https://bugs.php.net/bug.php?id=42355

Considered a new feature in 5.6

I have 5.5.9 right now and get the same results as you do