SQL PHP HTML ASP JavaScript articles and free scripts to download
PHP Declaring Variables


We can declare a constant by using define() function in PHP. Here is the syntax
Define( 'Constant', Value);
Let us start with some examples.
echo FNAME; // output : Alex
echo Fname; // output : Fname
In the above code the 2nd output does not show the data actually stored as our declared constants are case sensitive by default. To make them case insensitive we have to use another optional parameter case_insensitive set to TRUE
echo Fname; // output : Alex
We can't use hyphens while declaring any constants but we can use underscores
echo F-name; // output : 0

The difference between constant and variable is the data stored inside a constant is not changed throughout the execution of the program. Whereas variables can be assigned to different values at various stage of the program.

Be the first to post comment on this article :

Post Comment This is for short comments only. Use the forum for more discussions.
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer