A variable assignment such as $name = "john" can be repeated with a different value later in the code and be overwritten.

For example, the same $name variable can be assigned the value of "Jill" in the next line, and when echoed like below will overwrite it and display "Jill"

Jill

On the other hand constants cannot be changed later once defined. Constant names are also always uppercase.

An example of defining a constant is as follows, define('PERSON_NAME', 'John')

Like traditional variables, constants are used similarly but without a \$ (dollar) sign in front of it. Additionally, they are not usable within quotation marks.

John

Just like variables, constants can hold numbers as values aswell. Below is an echoed constant named SAVED_NUM, and then used in a concatenated string to get past not being usable within quotations.

777

The value of SAVED_NUM is stored as 777