11-29-2008, 02:52 PM
|
#2 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
The number 042 is an octal number (base 8) rather than a 'normal' decimal number (base 10). It's the octal 42 which can be explained below:
Octal
To work out the decimal value, multiply the header line by the digit line and sum those values. 8*4 + 1*2 which gives 34.
Compare this to decimal numbers
Code:
1000 100 10 1
- - 4 2
Multiplying the values together again: 10*4 + 1*2 which gives 42.
You can also use hexadecimal (base 16) by preceding the number with 0x. For example, all of the following have an integer value of 123.
PHP Code:
$num = 123; // decimal
$num = 0x7B; // hexadecimal
$num = 0173; // octal
More information can be found on the integers PHP manual page.
|
|
|
|