global within function via include not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
iPinky
Forum Newbie
Posts: 1
Joined: Wed Nov 12, 2003 2:56 pm
Location: Zürich, Switzerland

global within function via include not working

Post 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
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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?
Post Reply