[Solved] Removing leading zeros from number PHP


Since you provide a value in octal notation, you can cast it first into a string to simply trim the leading zero.
ltrim will cast any number into a string before trimming:

$month = ltrim($month, '0'); // string

Or:

$month = intval(ltrim($month, '0')); // integer

3

solved Removing leading zeros from number PHP