Chrome Extension

Define constant in PHP

    define(const_name, const_value); //SYNTAX
    define("month", "september");
We are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now

Constants can only be changed when initialize. In PHP you can define a constant by using the define() function which takes two required parameters constant name and constant value and one optional parameter case insensitive.

A constant is global means it can be accessed anywhere from the script once initialized and you also don't need to add the '$' keyword before the variable name to define a constant.


   define("firstname", "John");
   echo firstname;

   define("fruits", ["banana", "apple", "papaya"]);
   echo fruits[1];
Was this helpful?
Open Code Manager We are hiring