So in C# I create something like
private const int HEADER_LENGTH = 13;
private const byte SIGNATURE1 = 0x46;
How to create its analog in PHP?
So in C# I create something like
private const int HEADER_LENGTH = 13;
private const byte SIGNATURE1 = 0x46;
How to create its analog in PHP?
No. The closest things are:
const HEADER_LENGTH = 13;
which is not private and
private static $HEADER_LENGTH = 13;
which is not final. You cannot also constrict the type of the variable. There is also no 1-byte type in PHP – you should use an integer for that or a string with length 1.
You can implement something like that internally by overriding the get_property_ptr_ptr
and write_property
object handlers, but not with only PHP.