I don't know how to google this one out so I an asking it here. Why does it happen that when I declare a variable
$something = 0759
It is an Integer literal, you declare a octal number with a leading zero.
$something = 0759; // octal
The octal numeral system is a base-8 number system. You can only use Numbers between 0-7 (other numbers are discarded).
$a = 0759; $b = 075; var_dump($a==$b); // bool(true)
You could skip the zeros with ltrim.
$a = ltrim("0759", 0); echo $a; // 759 // and reformat as suggested with str_pad or printf echo str_pad($a, 4, "0", STR_PAD_LEFT);