I wonder how i can call a method of a class inside of a method in other classes that called method is in a class that declared after the classes that use inside. Let me show you an example:
Database.php:
class Database{
modifyUser($field,$change){
global $logging;
if($database->query('MYSQL QUERY')){
$logging->modifyUser($field,$change);
}
}
}
$database = new Database;
Logging.php:
class Logging{
modifyUser($field,$change){
global $database;
$database->query('Mysql Query for Logging');
}
}
$logging = new Logging;
now problem is if use top classes in included file like this:
user.php
include('database.php');
include('logging.php');
php shows an error that you use $logging variable which is not declared as class yet. and if I change like this:
user.php
include('logging.php');
include('database.php');
same error but for $database; I don't know how to use it that PHP doesn't conflict for sequences.