PHP Tutorial

Define PHP

PHP Installation


PHP Comment

PHP Case Sensitivity

PHP Variable, DataType

PHP Echo & Print

PHP Operators

PHP Receiving Input

Decision Making - if...else

PHP Switch Case

PHP Loops

PHP Jumping Statement

PHP Image Gallery

PHP File Upload

PHP Arrays

PHP Date Functions

PHP String Functions

PHP Math Functions

PHP Functions

PHP Variable Scope

PHP Constant Variable

PHP Superglobals

PHP Form Validation

PHP Include Statement

PHP Filter

PHP File Handling

PHP Cookies

PHP Session

PHP Send Emails

PHP Captcha

PHP MySQL Select

PHP MySQL Insert

PHP MySQL Delete

PHP MySQL Update

PHP MySQL Injection

PHP Assignment

Page Stats

Visitor: 221

PHP Constants

The value of a constant variable is fixed and cannot be change during the execution. By default a constant variables are case-sensitive. Normally, constant identifiers are always written in uppercase.
In PHP, to define a constant variable use define() function and to retrieve the value of a constant variable simply specify constant variable name. Unlike with variables, you do not need to have to specify a '$' symbol. You can also use the function constant() to read a constant's value.

Example 1: Constant Variable with integer value. Example 2: Constant Variable with string value. Example 3: Constant Variable with case-insensitive variable name. Example 4: Constant Variables are Global.