06-08-2008, 12:23 AM
|
#2 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
It has to do with variable scopes. Look at the following code
PHP Code:
<?php function seta() { $a = "Hello There"; }
seta(); echo $a; ?>
That will output nothing because $a is not in a scope for the code outside the UDF to access. Now look at this code
PHP Code:
<?php function seta() { global $a = "Hello There"; }
seta(); echo $a; ?>
That code will echo the value that $a was assigned to in the function.
|
|
|
|