they don't have much difference just that if recquire fails it stops execution whereas include failure just show error message
With include, even if the included file doesn't exist, it will still run the rest of the script. But with require, if the file doesn't exist, it will stop the whole script.
includes will continue on errors, require will stop the script if it does not find the file. In studies the most processor friendly is the require_once function. Always use that if possible
On the contrary. require_once() is slower than require() since first it must check if the file that you want to require() has been required and then if it hasn't it requires the file.
Hi we use both, for importing file, that's we need & there is no huge difference between them, and the main difference is that, showing Result. suppose you have file "index.php" and you want to use code that's define in "index.php", then you just import that file, by avoiding re writing same code. <?php include('index.php'); echo "Jai Shri Ram"; ?> ********************************** <?php require('index.php'); echo "OM Sai Ram" ?> and suppose some error occurs, the include() function generates a warning, but the script will continue execution. The require() generates a fatal error, and the script will stop. and suppose you face some eror here then
as it says require , requires file if there is not file it wont work but include will give u error and contiunes.
basically both of them have the same "meaning" , and have the same effect if the file exist !! the only difference that with include file , if the file doesnt exist , the file.php will continue the execution and return back to u with some errors. but when using REQUIRE <-- from the name of this function , the required file should exist , if NOT it will generate a fatal error which will cause the die of ur code.
Good explanation, except i would'nt call it meaning but functionality? Furthermore I don't see this thread going anywhere productive, as all the replies fulfill the OP's question, so this should be closed.