What role does the $ symbol play in PHP variable naming and how does its absence lead to errors in the code?

When naming variables in PHP, the $ symbol must be used at the beginning of the variable name to indicate that it is a variable. Failure to include the $ symbol will result in PHP interpreting the variable as a constant, which may lead to errors in the code.

// Incorrect variable naming without the $ symbol
name = "John";

// Correct variable naming with the $ symbol
$name = "John";