php - why there is a difference between below given output? -
$y = 07; echo 'y: '.$y; // result 7 $y = 08; echo 'y: '.$y; // result 0
:edit:
one more similar
$y = 013; echo $y + 5; //this result in 16
i can not figure out how ans 16? can 1 help?
part 1
the rules parsing explained in integers documentation.
in php number starting 0 assumed in octal. because 08 in octal isn't valid getting 0.
part 2
the same issue in play, 013 in octal 11 in decimal , 11 + 5 = 16
Comments
Post a Comment