String numbers into number numbers in PHP
How come when I set 00 as a value like this: $var = 00; it ouputs as 0 when I use it? How can I set 00 so that $var++ would become 01? Numbers in PHP (and virtually all languages) are not stored internally with leading (or in the case of decimal values, trailing) zeros. There are many ways to display your numeric variables with leading zeros In PHP. The simplest way is to convert your value to a string, and pad the string with zero's until it's the correct length. PHP has a function called str_pad to do this for you: $var = 0; $var += 1; // outputs '01' echo str_pad($var, 2, '0', STR_PAD_LEFT)