-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a1f5d1
commit 2a0befb
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
// 2 ways to declare constant in PHP | ||
// using define() | ||
// using const | ||
// With constant, $ (dollar sign) is not required | ||
|
||
/* | ||
using define() | ||
syntax: | ||
define(string $constant_name, mixed $value) | ||
*/ | ||
|
||
// Case sensitive | ||
define("CONSTANT_VAR", "This is a fixed value and cannot be changed<br/>"); | ||
echo CONSTANT_VAR; | ||
|
||
// Using const | ||
const ANOTHER_CONST_VAR = "This is another constant variable<br/>"; | ||
echo ANOTHER_CONST_VAR; | ||
|
||
?> |