are they same as die() & exit()?
what are the differents between require and include
For me required and include is very different commands, same like die() and exit(). But many people thinking both are same. Try to put somewhere in HTML (but not on bottom) include_once command, and dont create included file. E.G. <? include_once('dataaaas.txt'); ?>
Now run this PHP page. You will see your page is ok. Dataaas.txt is not included but everything other looking good. Now, change include u require, and everything below require command will lose!
Differences???
Sonam
P.S. I am tested this only on Windows, but I thing it is same on Linux.
Now run this PHP page. You will see your page is ok. Dataaas.txt is not included but everything other looking good. Now, change include u require, and everything below require command will lose!
Differences???
Sonam
P.S. I am tested this only on Windows, but I thing it is same on Linux.
| Quote: |
| require() 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. |
as found on http://uk2.php.net/require
May I suggest checking the php documentation. It is actually really helpfull and quite through
http://uk2.php.net/manual/en/index.php
If you cant work out the naviagtion use their search feature!
Great post Matt,
You are right, require() and include() do same thing but on error results are different. In that case we can conclude:
require() == include() is TRUE
require() === include() is FALSE
Sonam
You are right, require() and include() do same thing but on error results are different. In that case we can conclude:
require() == include() is TRUE
require() === include() is FALSE
Sonam
