Answered Questions

  • session_register and $_session

    What is the difference between session_register and $_session?

    abc

    • Sep 12th, 2011

    $_session for one or more variable
    session_register for global variables

  • What is difference between require_once(), require(), include().Becouse above three function usely use to call a file in another file.

    Star Read Best Answer

    Editorial / Best Answer

    bicu  

    • Member Since Sep-2005 | Feb 4th, 2006


    Difference between require() and require_once():  require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page).
    So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don't include the file more times and you will not get the "function re-declared" error.

    Difference between require() and include() is that require() produces a FATAL ERROR if the file you want to include is not found, while include() only produces a WARNING.

    There is also include_once() which is the same as include(), but the difference between them is the same as the difference between require() and require_once().

    aditya dhanraj

    • Apr 29th, 2015

    Require_once():-using this function we can access the data of another page once i. e we can not access the same page multiple times.

    require():-using this function we can access the data of another page at the desire page multiple times i.e we can access the contents of same page multiple times.

    LAILA NISHI

    • Feb 21st, 2015

    Include() and require() dose same work.The difference is on error cheeking .Require () gives a fatal error when file cant load whereas include() gives a warning and continue to execute.