How to Declare constant variable in php

How to create constant variable with syntax example tutorial in php.

Constants are same as other type of variables but there are a major difference between them that constants are defined once in whole php program and they cannot change after defining, values of constants are fix in whole program. Constants are works same as other variables and easily printable through echo . So here is the complete step by step tutorial for How to Declare constant variable in php.

android-project-download-code-button

Syntax to defining constant variable in php.

define(name, value, case-insensitive);

Here name specifies name of constant variable.

value specifies value of constant variable.

case-insensitive is used to define if web developer need to create the constant variable as case sensitive or not , It works with boolean values true or false and the by default value is false in it.

How to Declare constant variable in php.

Code for Declare_constant.php file.

<?php

define("BLOGNAME", "Android-Examples.com", true);

echo BLOGNAME;

?>

Screenshot:

How to Declare constant variable in php

Click here to download How to Declare constant variable in php project with source code.

Leave a Reply

Your email address will not be published. Required fields are marked *