Hey every one . I need your help . I am new to programming in php so i want to know what is 'define ' statement used for and how to use it and please give me some examples. I looked in w3schools but i did not find it .
Thanks for your help .

You set constants by using the define statement. The format is
define(“constantname”,”constantvalue”);
For instance, to set a constant with the company name, use the following
statement:
define(“COMPANY”,”My Fine Company”);
Use the constant in your script wherever you need your company name:
echo COMPANY;
When you echo a constant, you can’t enclose it in quotes. If you do, you
echo the constant name, instead of the value. You can echo it without any-
thing, as shown in the preceding example, or enclosed in parentheses.

You can use any name for a constant that you can use for a variable. Constant
names are not preceded by a dollar sign ($). By convention, constants are given
names that are all uppercase, so you can easily spot constants, but PHP itself
doesn’t care what you name a constant. You don’t have to use uppercase, it’s
just clearer. You can store either a string or a number in it.
The following statement is perfectly okay with PHP:
define (“AGE”,29);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.