include_once is self explanatory I understand perfectly how it works. I get that it will only include that include ONE TIME. GREAT !!! :)
My question is... If i only want that include ONE TIME on my page why am I having to write include_once when I could just simply only write the include one time in the first place. I'm sure there's a good reason why it would appear twice but the only examples I'm finding is someone typing the same include two times and I don't get why you'd go through the hassle of typing it twice but including the word "_once" so it only runs one time.
thanks.
One example where the files could call include twice could be protected pages or parent pages (dashboards, etc.) that might be including several "child" pages which might already have this code included.
Example:
content1.php
content2.php
Now - parent "dashboard" - let's call it view_dashboard.php might be including several files - all of which already have a copy of the same require_login.php protective script.
include_once is more slow than include so use it sparingly.