prashanth
(Prashanth Kvd)
1
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?
Bizley
(Bizley)
2
I think this is possible from PHP 5.6
alirz23
(Alirz23)
3
what version of php are you using?
Keith
(Kburton)
5
Yep, you can only assign literals to constants. It’s quite an annoying restriction and I’m glad they’ve finally fixed it.