PHP Constant
define() -
- The value of constant can not changed after assigned.
- It can hold value only strings and numbers.
- we do not use $ sign with constant name.
- It can hold value only strings and numbers.
In PHP, we declare constant by define() or The define() function defines a constant.
Syntax
<?php?>| Parameter | Desryption |
|---|---|
| Name | Represents the name of constant |
| value | Represents the value of constant |
| Optional | In optional parameter we use true and falsevalue if we enter TRUE constant remain case-insensitive otherwise constant will case-sensitive. |
Example
<?php?>Output :
Hello how are you?Example
<?php?>Output :
my name is rexNote -
PHP constants are similar as php variable and little more permanent.
No comments:
Post a Comment