Re: Accessing Class Method

I think you're confusing require_once with require. require_once has
to check if a file has been loaded or not, require does a
straightforward require - hence the speed boost.

About writing straightforward scripts. Using require instead of
require_once will cause php to throw an error the second you try to
redefine a class you already have (which will happen if you require a
file with the same class declaration twice). By all all means, use
require_once, it's a language statement, it's useful when you need to
use it, BUT a thought out OOP should _not_ need the *_once statements.
The flow of an OOP using a robust design paradigm (like MVC for
instance), should allow for full knowledge of which class gets
included where, if not you're looking at a need for a singleton, if
that doesn't help - delegate to the method required.

Like I said, I'm not imposing the sole usage of require over require
once (although I prefer it), I'm also not saying you should rewrite
existing code to gain the 0.xx ms advantage of require_once over

What I _am_ saying is that using plain require over require once has
solid benefits. And heck, if you can whine about his naming
conventions, why can't I about your coding style :)

On Sep 17, 10:36 pm, "Steve" <no....@xxxxxxxxxxx> wrote:
Btw. Try to write an OO application in a manner that would not require
the require_once statement, but rather a plain require. In part,
because it's faster, but mainly because it will force you to write
your applications in a much straightforward manner. Maybe
straightforward isn't the word here, but I'm tired as hell...

if both main_class and html require dal.php and could be used in the same
script, require_once is better and produces less parsing in php...and is
therefore faster than php having to check if it loaded a file already or
not. THAT is straightforward...probably not the word you're looking for.