hosted by liquidweb

Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : (PHP) Notice: Use of undefined constant

Forum Jump

(PHP) Notice: Use of undefined constant

Reply Post New Thread In Programming Discussion Subscription
Send news tip View All Posts Thread Tools Search this Thread Display Modes
Join Date: Sep 2004
Location: Sydney
Posts: 7

(PHP) Notice: Use of undefined constant

I'm a noob here, reading through SAMs PHP & MySQL Web Development. I can't get around this problem.

PHP Code:
$products = array( array("TIR""Tires"100),
"SPK""Spark Plugs"4));

    if ( 
$x[1] == $y[1] )
    else if ( 
$x[1] < $y[1] )
        return -

I'ts supposed to sort the arrays inside $products


Notice: Use of undefined constant compare - assumed 'compare' in C:\Inetpub\wwwroot\PHP\usort.php on line 16

Sponsored Links
Community Guide
Join Date: Jul 2003
Location: Kuwait
Posts: 5,099
Change to usort($products, 'compare');

Any string not encapsulated in quotes is considered a constant, and that message is just a Notice telling you that PHP thinks compare is a constant, but its not defined anywhere.

In order to understand recursion, one must first understand recursion.
If you feel like it, you can read my blog
Signal > Noise

Join Date: Sep 2004
Location: Sydney
Posts: 7
That did the trick, thanks fyre!

Sponsored Links

Related posts from
Title Type Date Posted
Canadians Sent Threatening Messages After Canada’s Online Copyright Rule Update Web Hosting News 2015-01-14 14:32:31
Wercker Gets $2.4 Million in Funding to Improve Cloud-Based Delivery Platform Web Hosting News 2014-10-03 10:12:41
Tech Companies Pledge Not to Remain Silent About Customer Data Requests Web Hosting News 2014-05-06 10:21:05
Sophos Launches Cloud-Based Managed Security Service Web Hosting News 2013-10-29 17:53:59
Web Hosting Sales and Promos Roundup – July 26, 2013 Web Hosting News 2014-05-23 15:42:54

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Log in with your username and password

Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Web Hosting News:
WHT Membership
WHT Membership



Welcome to

Create your username to jump into the discussion! is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.

(4 digit year)

Already a member?