View Single Post
Old 06-08-2008, 12:06 AM   #1 (permalink)
Dave
The Acquainted
 
Dave's Avatar
 
Join Date: Apr 2008
Posts: 110
Thanks: 97
Dave is on a distinguished road
Default A little unclear about "global" keyword...

I'm a little confused about the "global" keyword (not the $GLOBALS keyword).

Example in "main" part of a PHP script:

global $sun ;
$sun = "star" ;

I think the following statement is true, but is it?

If I write a user-defined function, I must again name the var $sun to be a global within the UDF in order for it to be available to use in the function (unless I pass it to the UDF as a parameter).

Thanks,
Dave
Dave is offline  
Reply With Quote