richie;10679123 wrote:If you want all leading zeros removed:
$value = 003;
$value = intval($value);
It may be just as good slightly faster to use typecasting instead of function
$value = (int)$value; //typecasting instead of a function.
For a discussion on the topic, try searching google for "php intval vs int"
Also, if you're running a mission critical app, then remember php int limit is 2,147,483,647, and any integer above this will give you exactly 2,147,483,647. So, you may want to catch it by using something like:
if ($value > 2,147,483,646) {
//take any necessary steps, but don't continue with the script since
// chances are it will all be reported as 2,147,483,647
exit("Integer values larger then 2,147,483,646 are all reported as 2,147,483,647 and will be inaccurate");
}
Good luck.