LoginSignup
12
4

More than 5 years have passed since last update.

PHPの変数のフリーダムさ

Posted at

PHPの変数名の規則があまりにフリーダムなのが話題になったので、思わずやってみた。
ちなみに正規表現的には'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'らしい。ずいぶん広い。

class 👨 {
    public function voice() {
        echo "お父さん";
    }
}

class 👩 {
    public function voice() {
        echo "お母さん";
    }
}


$👨 = new 👨();
$👩 = new 👩();

$👨->voice(); //お父さん
$👩->voice(); //お母さん
12
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
4