general php question: include_once vs setting flags

Discussion corner for Developers of Serendipity.
Post Reply
gregfuller
Regular
Posts: 13
Joined: Tue Oct 09, 2007 9:33 am

general php question: include_once vs setting flags

Post by gregfuller »

Hi folks,

I've been enjoying s9y, looks like a solid product with great features.

I noticed that in several places the system sets a constant (like S9Y_FRAMEWORK) and checks it to make sure a program is included only once.

Would anyone be so kind as to explain why "include_once" is not used?

My PHP experience is very limited, so the above is a real question about coding and not an underhanded attempt to question anyone's coding practices. Just trying to learn.

Thanks a bunch! --Greg
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: general php question: include_once vs setting flags

Post by garvinhicking »

Hi!

We tried to avoid include_once because some developer mentioned that using this would make Bytecode caches like APC work a bit slower.

Also, the Constants make it easier for plugins to check whether certain code includes are loaded for some probing routines.

In the end, however, it doesn't really matter and is just a simple preference of us developers. :)

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
gregfuller
Regular
Posts: 13
Joined: Tue Oct 09, 2007 9:33 am

Post by gregfuller »

HTH? YID !

Makes total sense. Thanks !

-- Greg
Post Reply