What are common errors that occur when trying to add a reference in a PHP script?

Common errors that occur when trying to add a reference in a PHP script include using incorrect variable names or not properly passing variables by reference. To solve this issue, make sure to use the correct variable names and use the "&" symbol before the variable name when passing it by reference. Example:

// Incorrect way of adding a reference
$var1 = 10;
$var2 = &$var1; // Incorrect usage of reference

// Correct way of adding a reference
$var1 = 10;
$var2 = &$var1; // Correct usage of reference