Page 1 of 1

global within function via include not working

Posted: Wed Nov 12, 2003 2:56 pm
by iPinky
I have the following setup:

In the main php file I create an object and include then a file which contains various functions which need that object.

Outside those functions I seem to have the object set, inside the functions I get an error, Object not defined. I USE global for the object inside the function.

Weird is:
when I call the included file on its own.. (with the object defined there) it works without a hassle..

any ideas?

workaround is to pass all variables as parameters, but there are quite many.

Michael

Posted: Wed Nov 12, 2003 6:04 pm
by JAM
I might be waaay of now, but [php_man]call_user_func[/php_man]() might be interesting in one way or the other?