faqts : Computers : Programming : Languages : PHP : kms : Classes

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 1 people (0%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

Can I use a class from within a function?

Dec 16th, 2005 09:01
Dennis Day, Frank Cicchetto,


Yes, You must globalize the class you wish to use inside the function
you are calling.  example:

    function read_address()
    {
        global $master_class;
        $address = "123 Main Street, Suburbia, MO USA";
        $fixed_address = $master_class->fix_this_address($address);
    }