PHP Parse error: Invalid literal Numeric

Asked

Viewed 2,964 times

1

Migrating to PHP 7 I’m getting the following error: Invalid numeric literal

For example: $itau = new Conta(1620, 030818);

PHP will return an error

Parse error: Invalid Numeric literal in index.php on line 35

How to solve this problem in case I need to 0 stay to the left?

1 answer

3


This error happens because the number given is not a valid octal, this notation is known to have a left zero.

Pass the value as a string (adding quotes) and not as a number.

Change:

$itau = new Conta(1620, 030818);

To:

$itau = new Conta(1620, '030818');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.