Skip to content

Instantly share code, notes, and snippets.

@sofish
Created March 14, 2012 03:06
Show Gist options
  • Select an option

  • Save sofish/2033716 to your computer and use it in GitHub Desktop.

Select an option

Save sofish/2033716 to your computer and use it in GitHub Desktop.
连字符串也可以++/--
<?php
function a() {
static $b = 'abc'; // 中文就不行了,写“你妹”会打印出来2个"你妹"
echo $b . PHP_EOL;
$b++;
}
a();
a();
?>
@yesmeck
Copy link

yesmeck commented Mar 14, 2012

因为字母会转换成在ASCII里与之对应的数字。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment