codeguy / modern-php

Companion code repository for Modern PHP by Josh Lockhart
Other
905 stars 276 forks source link

Code doesn't work #2

Closed SomebodySmart closed 9 years ago

SomebodySmart commented 9 years ago

I use register.php and the server does not like line 17

Parse error: syntax error, unexpected '[' in /home/obits/public_html/register.php on line 17

That's the line that says, [' cost' => 12] Hint: I have no idea what I'm doing. What am I doing wrong?

codeguy commented 9 years ago

You need to use PHP 5.4 or newer to use the newer array syntax.

codeguy commented 9 years ago

Closing this issue. But feel free to continue conversation. I'm here if you have any questions.

codeguy commented 9 years ago

Also, you can change that particular code example to this to make it work in earlier versions:

array('cost' => 12)