아래 코드의 결과를 확인해 보세요...
<?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
등록된 댓글이 없습니다.