A valid variable name in PHP starts with a letter or an underscore, followed by any number of letters, numbers, or underscores. According to normal regular expressions, it will be expressed as: '[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*'.
Note: The letters mentioned here are a-z, A-Z, and ASCII characters from 127 to 255 (0x7f-0xff).
Copy code The code is as follows:
$var = 'Bob';
$Var = 'Joe';
echo "$var, $Var"; // Output "Bob, Joe"
$4site = 'not yet'; // Illegal name change; starts with a number
$_4site = 'not yet'; // Legal variable name; starts with an underscore
$isite is = 'mansikka'; // Legal variable names; can be in Chinese
?>