You might be familiar with using PHP variables to store values in PHP scripts. PHP constants are similar, but have a few important differences, as you’ll see in this article.
php tutorial
PHP Variables
Like most programming languages, PHP lets you create variables in your scripts. A variable is a storage container that holds a value. This value can change as the script runs. You can:
- Assign any value you like to a variable
- Access the value stored in a variable, and
- Change a variable’s value at any time.
Variables are useful because they let you write flexible scripts. For example, a script that can only add 3 and 4 together isn’t very useful. A script that can add any two values together, though, is much more flexible.