PHP Parse error: Invalid numeric literal

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 do I solve this problem if I need to make 0 left?

    
asked by anonymous 19.06.2017 / 21:12

1 answer

3

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

Pass the value as a string (by adding quotes) instead of number.

Change:

$itau = new Conta(1620, 030818);

To:

$itau = new Conta(1620, '030818');
    
19.06.2017 / 21:54