Joel-

> Basically, it's used to determine if a given date should be linked or not.
> When I wrote it, I didn't expect it to work, since these two function:
> 
> valid_date()
> rant_exists()
> 
> are defined completely outside of the class.  In fact, they're defined in
> a functions file that I include (with include()) above where I define my
> rantCal class.  Shouldn't their names not be recognized within this class?
> I was assuming that a class was entirely self-contained, so it can't know
> about functions defined outside its scope.  However, it works just fine
> (that is, the functions get called), which is helpful, but it doesn't seem
> like the way things should work.

When functions are defined, they are available everywhere: in other
functions, in classes, and in subclasses. As far as availability
goes, any function you define is just as available as any of the
built-in PHP functions (like addslashes() for instance).

Personally, though I am not a HEAVY OO programmer, I cannot see why
having those functions UNAVAILABLE in the class would be
advantageous in anyway.

If you want a function to exist ONLY within a particular class, then
it should be created in that class, otherwise, it should be created
outside of any class, and is therefore available globally.

I can't say whether it SHOULD be the way it is or not... but I can
tell you that the behaviour you are describing is accurate and
intended.

Daniel J. Lashua


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to