Well, I guess many things are "accepted" now, but here's my two cents:

I wouldn't access global variables, instead you should pass everything you 
need as parameters.  Using global variables can come back to bite you 
occasionally because you may think you are changing a local variable at one 
point, but you actually change a global variable, and then who knows what 
will happen when you try to access the global variable later in your code 
expecting an int, for example, and it is suddenly a string...

As for using other user defined functions from elsewhere in your code, I 
think it depends on the context...  But think about what if you want to use 
this class elsewhere, then you will always need to copy over whatever file 
contains your other functions.  In that case it would obviously make more 
sense to contain whatever functions are needed inside of the class.

Hope that gives you some ideas.

Jeff

At 02:58 PM 2/20/2002 -0600, Chris Boget wrote:
>I'm still kind of new when it comes to dealing with classes.
>I'm curious, is it accepted practice for member functions of
>your class to:
>
>* access global variables
>* use non member, user defined functions
>
>Chris
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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

Reply via email to