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),
array( "OIL", "Oil", 10),
array( "SPK", "Spark Plugs", 4));
function compare($x, $y)
{
if ( $x[1] == $y[1] )
return 0;
else if ( $x[1] < $y[1] )
return -1;
else
return 1;
}
usort($products, compare);
I'ts supposed to sort the arrays inside $products
Outputs:
Notice: Use of undefined constant compare - assumed 'compare' in C:\Inetpub\wwwroot\PHP\usort.php on line 16