1<?php
2$a = "1234";
3echo "<pre>";
4echo "outer: $a\n";
5function testa()
6{
7 global $a;
8 echo " inner testa: $a\n";
9 unset ($a);
10 echo " inner testa: $a\n";
11}
12function testb()
13{
14 global $a;
15 echo " inner testb: $a\n";
16 $a = null;
17 echo " inner testb: $a\n";
18}
19testa();
20echo "outer: $a\n";
21testb();
22echo "outer: $a\n";
23echo "</pre>";
24?>
25/***** Result:
26outer: 1234
27 inner testa: 1234
28 inner testa:
29outer: 1234
30 inner testb: 1234
31 inner testb:
32outer:
33******/
2$a = "1234";
3echo "<pre>";
4echo "outer: $a\n";
5function testa()
6{
7 global $a;
8 echo " inner testa: $a\n";
9 unset ($a);
10 echo " inner testa: $a\n";
11}
12function testb()
13{
14 global $a;
15 echo " inner testb: $a\n";
16 $a = null;
17 echo " inner testb: $a\n";
18}
19testa();
20echo "outer: $a\n";
21testb();
22echo "outer: $a\n";
23echo "</pre>";
24?>
25/***** Result:
26outer: 1234
27 inner testa: 1234
28 inner testa:
29outer: 1234
30 inner testb: 1234
31 inner testb:
32outer:
33******/