views:

35

answers:

1

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?

+1  A: 

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.

Artefacto
and will const SIGNATURE1 = 0x46; be avaliable for bites like operations? (see my next Question http://stackoverflow.com/questions/3070298/what-is-php-for-c-readbytesstream-langth )
Blender
Artefacto