Hello!

On my first PHP project, I coded all of my include/require files as:

PHP Code:
require_once(../../main/restrict_access_index.php'); 
It's kind of a pain and not super clear coding in my opinion. Diving into my second PHP project, I was hoping to use the $_SERVER global variable and DOCUMENT_ROOT as below:

PHP Code:
require_once($_SERVER["DOCUMENT_ROOT"].'/main/restrict_access_index.php'); 
Is this better coding practice or might there be another solution that I'm not aware of?

Thank you,

Eric