View Single Post
Old 06-08-2008, 12:23 AM   #2 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

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.
__________________

Village Idiot is offline  
Reply With Quote
The Following 3 Users Say Thank You to Village Idiot For This Useful Post:
Dave (06-08-2008), ETbyrne (06-08-2008), Orc (06-11-2008)