ON7 Posted October 26, 2014 Share Posted October 26, 2014 So I'm trying to learn PHP so that I can work with the SteamAPI. I have previous coding experience (C, Java) and I'm uncertian on why my script isn't working. API: https://github.com/andrewmcwatters/steamweb-php-api Error: Parse error: syntax error, unexpected '[' in index.php on line 51 Line 51: $parameters = ['key' => STEAM_WEB_API_KEY]; From what I've understood, the script is trying to create an array called "parameters" and inside it's trying to create a variable called "key" which is going to hold the constant "STEAM_WEB_API_KEY". This constant is suppose to be loaded from a file called "steamwebapi_config.php" which looks like the following: <?php /** * Steam Web PHP API */ const STEAM_WEB_API_KEY = 'your steam api key that is given by vavle'; I didn't attach my actual key in the script above for obvious reasons. I have no idea how to fix this issue nor what is casuing it.Again, I'm not experienced with PHP and I'd appreciate any help you guys can give me! Thanks to anyone who helps. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted October 26, 2014 Share Posted October 26, 2014 (edited) I think you want: $parameters['key'] = STEAM_WEB_API_KEY; Edited October 26, 2014 by ginerjm Quote Link to comment Share on other sites More sharing options...
ON7 Posted October 26, 2014 Author Share Posted October 26, 2014 I think you want: $parameters['key'] = STEAM_WEB_API_KEY; That seemed to make the error go away. Thank you! Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted October 26, 2014 Share Posted October 26, 2014 FYI Line 51 uses shorthand array syntax introduced with PHP5.4. You are using an older version of PHP and this is why you are getting that error message. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.