Alternative approach to require_once('header.php')?

I’m a part-time coder and historically, I always do require_once(‘header.php’);

However, is this the most efficient approach when I have to go deeper into subdirectories?

E.g. require_once(‘…/…/…/header.php’);

Thanks in advance.

Great - thank you!

According to documentation, it’s better to use absolute paths with require or require_once.

  • When using absolute_path there are fewer stat() system calls.
  • When using relative_path there are more stat() system calls because it has to start stat()ing from the current directory back up to / and then to the include/ directory.

more on

hope this will help you :cool: