What is difference between include,require,include_once and require_once() ?

Sharad Jaiswal
Sharad Jaiswal

Posted On: Sep 12, 2018

 

    1 Answer Written

  •  Sharad Jaiswal
    Answered by Ajay
    • Include and require both uses to include a PHP page within another PHP page in a project to initialize some predefined functions or programs. But the only difference between both is that if you have
      used include(test.php) and test.php does not exist then you would receive a warning error but
      execution would not interrupt while, if you have used require(test.php) and test.php does not
      exist then you would receive a fatal error and execution would be interrupted.
    • Same thing happens with include_once and require_once except that in that case file is required
      only once.

Please Login or Register to leave a response.

Related Questions

PHP Interview Questions

What is T_PAAMAYIM_NEKUDOTAYIM ?

T_PAAMAYIM_NEKUDOTAYIM is scope resolution operator used as :: (double colon) .Basically, it used to call static methods/variables of a Class...

PHP Interview Questions

What is the difference between == and === operator in PHP ?

In PHP == is equal operator and returns TRUE if $a is equal to $b after type juggling and === is Identical operator and return TRUE if $a is equal to $b, and they are of the same data type...

Ask a Question