[PHP-users 22736]Re: PerlのDESTORYメソッドに匹敵するもの

R.Watanabe ryouhei @ saturn.interq.or.jp
2004年 7月 23日 (金) 12:42:51 JST


こんにちは、渡邉です。

PHPにはPerlのmyに相当する修飾子はありません。
しかし、関数内の変数は、ローカルスコープになります。

[test.php]
<?php
function funcA() {
    $str = "funcA()";    // この$strはローカル変数
    echo "str=$str\n";
}

funcA();
echo "str=$str\n";
?>

[実行結果]
-------------
str=funcA()
str=
-------------


PHP-users メーリングリストの案内