What is the purpose of defining constants in PHP scripts, and how can they be used effectively?

Defining constants in PHP scripts allows for the creation of values that do not change throughout the script's execution. Constants are useful for storing values that are used repeatedly and should not be altered. They can be used effectively by providing a clear and easily identifiable name for important values in the code.

define("PI", 3.14);
echo "The value of PI is: " . PI;