Scope Variable
Contoh:
$x = 5; // variabel global
function tesLokal() {
$y = 10; // variabel lokal
echo $y;
}
function tesGlobal() {
global $x;
echo $x;
}
function tesStatic() {
static $count = 0; // variabel statis
$count++;
echo $count;
}
tesLokal(); // Output akan 10
tesGlobal(); // Output akan 5
tesStatic(); // Output akan 1
tesStatic(); // Output akan 2Informasi Tambahan:
Last updated