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 underscore
$i site is = 'mansikka'; // Legal variable name; can be in Chinese
?>
Someone just gave me a php file. When I opened it, I was shocked. Could it be that the legendary Chinese programming is so easily implemented in PHP?
I just looked through the Chinese PHP manual and there are indeed examples of Chinese variables
http://www.bkjia.com/PHPjc/323912.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323912.htmlTechArticleA valid variable name in PHP starts with a letter or an underscore, followed by any number of letters, numbers, or Underline. According to normal regular expressions, it will be expressed as: ...