Watch Our YouTube Channel
It is currently Wed Jun 28, 2017 12:24 pm
 

All times are UTC



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Dec 05, 2016 8:59 am 
Offline

Joined: Fri Nov 13, 2015 3:56 am
Posts: 414
Include will let the script keep running (with a warning) if the file is missing.include_once will throw a warning, but will not stop PHP from executing the rest of the script.optional dependencies that would produce errors on subsequent loading or maybe remote file inclusion that you do not want to happen twice due to the HTTP overhead

Require will crash if it's missing.require_once will throw an error and will stop PHP from executing the rest of the script.when the file contains content that would produce an error on subsequent inclusion, is definitely needed in your application but since functions cannot be re-declared should not be included again.

Code:
include_once "connect_to_mysql.php";

require_once "connect_to_mysql.php";


The difference is that require_once() will produce a Fatal Error on failure, while include_once() only produces a warning.

_________________
Learn Web Development | Latest Technology News |Motivational Quotes


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 10, 2017 5:52 am 
Offline

Joined: Wed Jul 01, 2015 11:28 am
Posts: 172
Location: Bangalore
The difference is that require_once() will produce a Fatal Error on failure, while include_once() only produces a warning. include_once will throw a warning, but will not stop PHP from executing the rest of the script. require_once will throw an error and will stop PHP from executing the rest of the script.

_________________
Digital Marketing Company in India| Web Design Company in India | SEO Services in India


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: