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

What is the differences between $a != $B and $a !== $B?

536


When use javascript vs php?

537


Explain me how failures in execution are handled with include() and require() functions?

610


How to count all the lines of code in a directory and sub folder?

514


What is Type hinting in PHP?

715






What advance thing in php7?

519


Does php support multiple inheritance?

499


What is php array function?

543


How do you debug php?

564


What is php constructor?

541


What is cookie and why do we use it?

530


discuss the issue of software theft in ghana and how it has affected the economy

1673


Why do we use cookie?

549


Php error constants and their descriptions

579


What is the difference between query and question?

520