Assignment 1

Barry Molina

Constants

Constants are variables that cannot be changed once they are defined.

Unlike normal variables, constants are global in scope and don't use the dollar sign.

define('APPLES', 2056);
define('APPLE_PICKERS', 8);

echo 'There are ' . APPLES . ' apples and ' . APPLE_PICKERS . ' people to pick them.';
echo 'That\'s ' . APPLES / APPLE_PICKERS . ' apples per person.';

Output:

There are 2056 apples and 8 people to pick them.
That's 257 apples per person.
constant.php source code screenshot