What are the differences between require and include,
include_once?

Answer Posted / sri harsha

include();--> include the file, but in case of file missing
throws a warning and continues execution of code of next line.

require();--> require also includes the file but in case of
file missing throws an fatal error and stop the execution of
the code of next line.

include_once();-->if same file was included first it will
not include the file another time.

Is This Answer Correct ?    46 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which php function will attach one file to another?

529


What is the scope of a variable defined outside a function?

541


What is the use of isset() in php?

534


Tell me how to strip whitespace (or other characters) from the beginning and end of a string?

532


Tell me how comfortable are you with writing html entirely by hand?

512






What is a path Traversal?

555


What is return in php function?

490


How to parse configuration file in php?

529


How to get number of elements in an array?

535


How do you put a space in html?

517


What was the old name of php?

955


What distinguishes php from something like client side java script?

533


Tell me how can we connect to a mysql database from a php script?

505


Are php variables global?

558


What is constructors and destructors?

537