php global範例

Example #1 $GLOBALS 範例php

<?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();
?>

以上例程的輸出相似於:ide

$foo in global scope: Example content
$foo in current scope: local variable
沒有平白無故的榮耀 
相關文章
相關標籤/搜索