What rule does PHP follow when converting dots and spaces in variable names to underscores?

When converting dots and spaces in variable names to underscores in PHP, the rule followed is to replace dots and spaces with underscores. This is because dots and spaces are not allowed in variable names in PHP, so they need to be replaced with underscores to adhere to PHP naming conventions.

// Replace dots and spaces in variable names with underscores
$first.name = "John";
$last name = "Doe";

$first_name = "John";
$last_name = "Doe";

echo $first_name . " " . $last_name;