I have been trying to test how it is possible to run functions of a local, external PHP class file and I have had no luck with it at all.
I have two classes;
<?php
Class Conversion {
public function convert () {
return "HI!";
}
}
?>
And:
<?php
class Config {
}
$t = new Conversion();
echo $t->convert();
?>
Both of these files are in the same directory when I test them and yet I can never get an output when using the Config class, why is this? When I instantiate and echo the Conversion class within the Conversion.php file it works fine, but I can’t get it to work when doing the same in the Config.php file – why is this?
Having them in the same directory isn’t going to do anything. You have to include one in the other to use it’s code.