Jump to content

Recommended Posts

Hi,

I've tried many times, but I have been unsucsessful in determining why this code won't work.  I've tried everything, but still no luck.

 

$users = array(
  "dog" => "asdfghjkl",
  "cat" => "qwertyuiop",
);

but I still get this error every single time:

 

Parse error: syntax error, unexpected ')', expecting ']' in /www/zxq.net/a/r/k/arkazex/htdocs/UserLogin/Login/Login.php on line 10

and If I try to change the ");" on the last line to "];" the error switches saying that's wrong as well.  I've been stuck for quite a while, and any help would be greatly appreciated.  Thanks,

 

Arkazex.

Link to comment
https://forums.phpfreaks.com/topic/276363-arrays-simply-refuse-to-work/
Share on other sites

You shouldn't have a comma after the last array item, however that would not cause the error you are getting. Your error most likely comes from some other bit of code above that section, you need to post more of the code, or look higher.

 

Just because PHP says an error is on line XX does not mean that is where the error actually is. That is just how far PHP managed to get before the code stopped making sense. Some problems such as forgetting quotes or brackets can result in an error not being reported until much later in the code than where your problem actually is.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.