Jump to content

Notice: Use of undefined constant variable - assumed 'variable' in ...


Recommended Posts

I have just re-installed Xampp and suddenly my sites are now displaying lots of:

 

Notice: Use of undefined constant name - assumed 'name' in ...

Notice: Use of undefined constant price - assumed 'price' in ...

 

this is an example of the line its refering too:

 

$defineProducts[1001] = array(name=>'This is a product', price=>123);

I have tried

 

$defineProducts[1001] = array("name=>Loom Style Conservatory Suite in White Cane, price=>375");

 

and

 

$defineProducts[1001] = array("name=>Loom Style Conservatory Suite in White Cane", "price=>375");

 

and

 

$defineProducts[1001] = array(name=>"Loom Style Conservatory Suite in White Cane", price=>"375");

 

but doesn't work

The manual section on Arrays will tell you everything you need to know about proper array syntax.

 

Also, you were developing without error-reporting turned on before.  Always turn it on and leave it on, otherwise one day you'll realize every single line of array access is wrong.

 

-Dan

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.