Dear Sir,

I want to optimize my php code, by replacing "include" by "require_once". So if i have different PHP files that include the same php file..is it worth to replace each include by require_once in each file.

And if in the same php file, for example include("connect.php") is used more than once ( in each function )..what shall i do here to avoid the repetition of include?
can i replace each include by require_once

Require is better than Require_once (regarding the speed)??

if anyone can help me

Thank you..

    if you use include, then you could use include_ once.

    include_once won't include a file included before.

    So you could use include_ once on evry cases.

      It's also important for the OP to understand the difference between include and require. If an include file is not present, the browser will continue to execute the remainder of the page.. in the case of require, if a required file is missing, the page execution stops with a fatal error.

        Write a Reply...