Hacker News new | ask | show | jobs
by zemo 4428 days ago
> are there languages where you can't declare a constant with a multiplication expression?

obviously PHP.

  php > const X = 1;
  php > echo X;
  1
  php > const Y = 1 * 2;

  Parse error: parse error, expecting `','' or `';'' in php shell code on line 1
  php > echo Y;
  Y
1 comments

Fixed in the (upcoming) PHP 5.6.

https://wiki.php.net/rfc/const_scalar_exprs