Defining Constants [#10] Code Dynamic Websites with PHP

Опубликовано: 19 Ноябрь 2024
на канале: Brad Hussey
10,863
73

Lecture 10: Defining Constants

A constant is similar to a variable in the sense that you can store information in a keyword that can be used throughout your web page. However, the value of a constant cannot be changed, unlike a variable. It's literally "constant".

It's also worth noting that constants are case-sensitive and are written in ALL CAPS by convention. Here's how you define a constant in PHP:

define("TITLE", "Defining Constants");

To display a constant on your page, you can echo it using PHP, like this:

echo TITLE;

DOWNLOAD COURSE FILES HERE
http://www.bradhussey.ca/download-php...