PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
timvw wrote:Offcourse there is already such a function
There is no function that can make php pad an integer with leading zeros, only strings... The original post said a number. Strings may contain digits but they are not numbers.
Well since he said formatting a number with leading zeros I automatically understood he meant a string, not a number.
There's no way you can add formating to any type without converting it to a string first, unless, of course, you are God.
timvw wrote:Offcourse there is already such a function
There is no function that can make php pad an integer with leading zeros, only strings... The original post said a number. Strings may contain digits but they are not numbers.
The result of 'formatting' a number leads to a string..
But as the printf examples shows there is no need to convert the number to a string first (even there was such a need, php would probably take care of it...)