How to Define a Constant in PHP? Is $ symbol necessary?

Answer Posted / nilsoft

define("CONSTANT", "Its constant");

echo CONSTANT; // Outputs Its Constant

There is no need to use $ sign for it.
$ sign is used for declare variables.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is it possible to parse a configuration file?

505


What are the advantages of stored procedures?

544


Difference between mysql_connect and mysql_pconnect?

502


What is php and why we use it?

487


Can we learn php without html?

539






Which is used to maintain the value of a variable over different pages?

563


Tell me how do I check if a given variable is empty?

531


Is python easier than php?

534


What is the use of header() function in php?

539


Can we override static method?

520


How to pad an array with the same value multiple times?

466


What is strlen function in php?

512


What are some of the advanced features of php?

498


How to get complete current page url in php?

553


Can we set session value in javascript?

521