I'm working on a small project, and I was hit with a brick wall today; one that I surprisingly couldn't find an answer to.
So heres my setup,
config.php => loads 'user.php' and 'project.php'
user.php => class script loaded into 'config.php'
project.php => class script loaded into 'config.php'
main.php => uses 'config.php' to access 'user.php' and 'project.php'
Now, to clarify my problem, I want 'user.php' to be able to access 'project.php' through 'config.php'.
config.php
require_once( 'connect.php' );
require_once( 'user.php' );
require_once( 'project.php' );
// ...
user.php
Project::function(...);
// ...
I want 'user.php' to be able to access 'config.php' to access variables and other classes, and I know 'require_once' only let's config inherit from the specified file, but I'm wondering if there's a workaround that lets both access eachother.
Any suggestions? User and Project are in two entirely separate directories for specific reasoning.
In your config.php, include project.php prior to including user.php. This should give user.php access to everything in project.php.