댓글 검색 목록

[PHP] $GLOBALS 사용 예

페이지 정보

작성자 운영자 작성일 15-02-15 17:29 조회 2,896 댓글 0

아래 코드의 결과를 확인해 보세요...

 

<?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 

댓글목록 0

등록된 댓글이 없습니다.

웹학교 로고

온라인 코딩학교

코리아뉴스 2001 - , All right reserved.