1
Bassman
PHP Question
  • 2004/1/18 23:58

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


I'm sure there will be a PHP guru who will be able to answer this easily......

I've noticed that some modules begin with the lines

require(...blah/..blah etc)

whereas others use

include(...blah/..blah etc)

as far as I can see, it seems to do the same thing - usually includes the mainfile.php, header etc. So, why the 2 different options?

2
DaBoyz
Re: PHP Question
  • 2004/1/19 0:18

  • DaBoyz

  • Just popping in

  • Posts: 79

  • Since: 2002/8/8 1


Here ...

Quote:
The include() statement includes and evaluates the specified file.

The documentation below also applies to require(). The two constructs are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, 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.

3
Dave_L
Re: PHP Question
  • 2004/1/19 0:32

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


In addition, it's usually preferable to use include_once or require_once in place of include or require.

4
Bassman
Re: PHP Question
  • 2004/1/19 0:47

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


Quote:

Dave_L wrote:
In addition, it's usually preferable to use include_once or require_once in place of include or require.


Yes, i've seen that on occasions too

Thanks for clearing that up, it was mainly for my own benefit, It had been bugging me :)

Login

Who's Online

183 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 183


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Dec 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits