Create constants with bitwise operators

I want to create a constant in my component class file with bitwise operator.

For example


class MyClass{


   const MYCONST = 1<<3;

   --

   --

}

But it gives error saying Parse error: syntax error, unexpected T_SL, expecting ‘,’ or ‘;’.

How can i define constants with bitwise operators?

I think this is possible from PHP 5.6

what version of php are you using?

5.3.10

Yep, you can only assign literals to constants. It’s quite an annoying restriction and I’m glad they’ve finally fixed it.