I’m a little new to PHP and I’m not sure if this is used or discouraged or whatever. I’m wondering how PHP handles this kind of array and whether or not I should use it.
The array looks something like this.
$arr = [0x00010000 => $valueOne, 0x00020000 => $valueTwo] // and so on
The value variables represent a single number that is somewhere between the surrounding keys. E.g. valueOne ranges from 0x0001000 to 0x0001FFF. The array is expanded using the same pattern as more values are needed.
Thanks!
There’s nothing wrong with what you’re doing, you’re just using a numerically indexed array, but instead of using decimal notation to define the keys, you’re using hex notation. PHP handles both cases (decimal and hex) in the same way.
The following in decimal is equivalent: