include or not include, that is the question<

liunx

Guest
Should I use include or require and does it make a big difference?not having heard of require before i am assuming they both do the same things?

if they do then theres no real difference, i use includes and i have no problemsrequire() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don't hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well.

The manual boys, always the manual. :)
<!-- m --><a class="postlink" href="http://www.php.net/requireYep">http://www.php.net/requireYep</a><!-- m -->, rydberg's got it. The only differences occured in old versions of php.Huh, both agreeing and disagreeing, Josh? Throwing differents kinds of errors, still makes them different to each other. Perhaps you meant that fact that require() used to include and parse a file in PHP 3, no matter where the function was called, as stated in a comment in the manual.Perhaps you meant that fact that require() used to include and parse a file in PHP 3, no matter where the function was called, as stated in a comment in the manual.

Yah, that's what I was thinking of. I didn't read the manual for require, just what you quoted in our post.

It seemed like there was something else though, probably wrong though. I thought I remembered reading something in that wonderful book you reccomended to me.Speaking of that book, you should be done reading that by now.. I think it's time to kick it up a notch, this is what you want to get next (<!-- m --><a class="postlink" href="http://www.sitepoint.com/books/phpant1/">http://www.sitepoint.com/books/phpant1/</a><!-- m -->)! ... If you want to become a real guru, that is ;)Well no, I'm not done yet :O

I don't get much time to read any more with school and lacrosse. i have gotten a decent portion of it done though. I'm at page 500 I think. Only a few things I've had trouble understanding so far. Among them are regex's, SQL(language), and displaying results of a query. I've also had a little trouble with images, but I have no real reason to use that right now. I think I understand classes pretty well though.

Thanks for the link, I"ll pick that up when I get the money :)Oh I see. But yes, definitely save that link, those two books are the best, most up to date PHP books out there right now. No other book deals with object oriented programming, design patterns, XML etc. in depth like these do. Great value for you buck.
Although this is not your top priority right now(what with the lacrosse and all ;)), I highly recommend this book (<!-- m --><a class="postlink" href="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</a><!-- m -->) on regular expressions. This is simply one of the best computer related books available. I mean, I really enjoyed it, and it's almost 500 pages about regexes! (Okay, I skipped the parts about Perl.) You don't know the power of the ... regex side(?).
SQL is a fairly small and simple language, just read those sections again, and I'm sure it'll stick, they provide quite good coverage, I believe.
Well, we've gone far enough out of topic. ;)
 
Back
Top