Site Cloner PHP Script
Bargain Hunter PHP Script
Job Hunter PHP Script
Site Login and Access Control PHP Script

Constants in PHP

Using Constants in php can cut down a programmer’s time and keep organized code handy since one word can be used to represent an integer or string. The define() function is used to name a constant and and create a value for the constant.

The code below whows how to create two constants and output the constants’ values in an echo statement.

define(‘MYCONSTANT’, “My constant text string can have”);

define(‘MY_SECOND_CONSTANT’, ‘ double or single quotes.’);

echo MYCONSTANT.MY_SECOND_CONSTANT;