Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DEFINE - why won't it work?

Status
Not open for further replies.

770

Programmer
May 21, 2003
2
0
0
US
My script reads:

define ("WEEK", $week);
if (defined(WEEK)){
echo "week IS defined.";
}

I never get to the echo; Why is my define failing?


 
The argument of defined() must be quoted:

Code:
 define ("WEEK", $week);
     if (defined("WEEK")){
    echo "week IS defined.";
     }

try that...

cheers
 
The use of a defined constant allows you to just type the constant name in the code:
Code:
define("MYCONSTANT",'whatever');
echo(MYCONSTANT);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top