Ejemplo n.º 1
0
    global $y1;
    $y1 = 30;
}
function set_global_y2()
{
    $GLOBALS["y2"] = 40;
}
// First test; everything works as expected
$x1 = 10;
$x2 = 20;
unset($y1);
unset($y2);
show_global_x1();
show_global_x2();
set_global_y1();
set_global_y2();
echo "y1: {$y1}\n";
echo "y2: {$y2}\n";
// Second test, after unset($GLOBALS) in the global scope
// $x2 and $y2 now disappear, but $x1 and $y1 still work
unset($GLOBALS);
$x1 = 10;
$x2 = 20;
unset($y1);
unset($y2);
show_global_x1();
show_global_x2();
set_global_y1();
set_global_y2();
echo "y1: {$y1}\n";
echo "y2: {$y2}\n";
Ejemplo n.º 2
0
<?php

function set_global_y1()
{
    global $y1;
    $y1 = 30;
}
// Second test, after unset($GLOBALS) in the global scope
// $x2 and $y2 now disappear, but $x1 and $y1 still work
unset($GLOBALS);
$TSe10 = set_global_y1();
$TSp5 = printf($TLE31, $TLE25);