I want to reference a file that is in my root directory , The problem is that this file is used by several other PHP scripts that can be 2 or three paths deep.
I can reference this by
'../database_sql/dbconnect.php' ; 1 deep
'../../database_sql/dbconnect.php' ; 2 deep
'../../../database_sql/dbconnect.php' ; 3 deep
My question is how can I reference this root folder file without knowing how deep the path is ie: not using ../../../ etc
Two solutions:
The first is to define a constant whose value is the root directory:
The second is to use the include_path: