php global范例

时间:2014-05-09 13:25:52   收藏:0   阅读:309

Example #1 $GLOBALS 范例

<?php
function test() {
    
$foo = "local variable";

    echo 
‘$foo in global scope: ‘ . $GLOBALS["foo"] . "\n";
    echo 
‘$foo in current scope: ‘ . $foo . "\n";
}

$foo = "Example content";
test();
?>

以上例程的输出类似于:

$foo in global scope: Example content
$foo in current scope: local variable

php global范例,布布扣,bubuko.com

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!