tmyonline Posted November 3, 2008 Share Posted November 3, 2008 Guys, what's the difference between request() & request_once(), include() & include_once() ? I did some Google search but didn't find anything reliable. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/131230-difference-between-request-request_once-include-include_once/ Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 http://www.phpfreaks.com/forums/index.php/topic,195878.msg882553.html#msg882553 Quote Link to comment https://forums.phpfreaks.com/topic/131230-difference-between-request-request_once-include-include_once/#findComment-681318 Share on other sites More sharing options...
Andy-H Posted November 3, 2008 Share Posted November 3, 2008 require "file.ext"; This will require the file and give an error killing the page like a die() command if it fails or the file has already been required require_once "file.ext"; Same as require but command is ignored if the file has already been required. include "file.ext"; This will give an error if it fails but continue running the script like the trigger_error() function include_once "file.ext"; will be ignored if the file has already been required, give an error if it fails and continue the rest of the script. I think thats how it goes anyway Quote Link to comment https://forums.phpfreaks.com/topic/131230-difference-between-request-request_once-include-include_once/#findComment-681319 Share on other sites More sharing options...
NathanLedet Posted November 3, 2008 Share Posted November 3, 2008 Just clarifying - You did mean 'require', not 'request'... ? Is there any significant difference or reason why I should use require ("file.ext"); versus require "file.ext"; Quote Link to comment https://forums.phpfreaks.com/topic/131230-difference-between-request-request_once-include-include_once/#findComment-681332 Share on other sites More sharing options...
tmyonline Posted November 3, 2008 Author Share Posted November 3, 2008 Oh yeah, I meant require() and not request(), sorry! Thanks guys. I appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/131230-difference-between-request-request_once-include-include_once/#findComment-681337 Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 Just clarifying - You did mean 'require', not 'request'... ? Is there any significant difference or reason why I should use require ("file.ext"); versus require "file.ext"; nope, require is a "keyword"...just like print...so you can use it with or without the parenthesis Quote Link to comment https://forums.phpfreaks.com/topic/131230-difference-between-request-request_once-include-include_once/#findComment-681340 Share on other sites More sharing options...
NathanLedet Posted November 3, 2008 Share Posted November 3, 2008 Thanks Aaron Quote Link to comment https://forums.phpfreaks.com/topic/131230-difference-between-request-request_once-include-include_once/#findComment-681343 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.