Parse error: Invalid numeric literal

This comes from the changes made to how integers, specifically octals, are handled in PHP7 (as oppsoed to PHP5).

From the documentation (from PHP7 migration)

Invalid octal literals

Previously, octal literals that contained invalid numbers were silently truncated (0128 was taken as 012). Now, an invalid octal literal will cause a parse error.

From the documentation of integers

Prior to PHP 7, if an invalid digit was given in an octal integer (i.e. 8 or 9), the rest of the number was ignored. Since PHP 7, a parse error is emitted.

Either use them as strings, or actual integers

$a = array(1, 8, 9, 12); // Integers
$a = array("00001", "00008", "00009", "00012"); // Strings

Leave a Comment