Zero left inside integer variable [duplicate]

1

Good afternoon guys, hit the following doubt:

When I define within an integer variable the left zero it returns me in the echo a number nothing to see, I would like to know why:

Following is an example:

 <?php
 echo $inteiro = 015;
//me retorna o seguinte valor: 13 gostaria de saber o pq?
 ?> 
    
asked by anonymous 12.09.2014 / 20:44

1 answer

6

Because 015 is the octagonal representation of decimal 13.

copied from the manual

<?php
$a = 1234; // decimal number
$a = -123; // a negative number
$a = 0123; // octal number (equivalent to 83 decimal)
$a = 0x1A; // hexadecimal number (equivalent to 26 decimal)
$a = 0b11111111; // binary number (equivalent to 255 decimal)
?>
    
12.09.2014 / 20:52