Hi Mike,

        I realise that last night. I'm now using $GLOBALS['page_title']

In what situation would create_global() be useful then?

Thanks.

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-----Original Message-----
From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 09, 2003 6:20 PM
To: Ow Mun Heng; Ford, Mike [LSS]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] include/require inside of function


> -----Original Message-----
> From: Ow Mun Heng [mailto:[EMAIL PROTECTED]
> Sent: 09 July 2003 03:44
> 
>       I finally got it. Thanks. All I needed to do was just 
> define global
> $page_title inside the function to denote that I wanted to use that
> variable.
> 
> One other quick question, in my original code (per below) the function
> create_global() was used to create_globals on demand. But 
> this involved a
> lot of jumping, from one function to another just to create 
> the globals on
> demand. Is this efficient (more?? less??) compared to just 
> stating global
> $page_title inside the function?

I don't think create_global() is of any use to you in this situation --
you're just wasting the time taken to do the function call and return. Just
do either:

 function org_display_title_code()
 {
        global $page_title;
 
        echo 'This is title1 -> ' . $page_title;
 }

Or:
 
 function org_display_title_code()
 {
        echo 'This is title1 -> ' . $GLOBALS['page_title'];
 }

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to