I'm playing with a CMS that utilizes Namespaces and I'm trying to make use of it instead of including files and using functions within those files.
From what I understand and have tried, I have a file loaded as a PSR-4 with a declared namespace, class, and a function inside that I'd like to access. It looks like:
namespace MyFunctions;
class basic {
function say_hello($a) {
echo "Hello, $a";
}
}
And from another file, I can see that the "MyFunctions" namespace is indeed loaded when checking using the get_declared_classes() function. However, I'm completely lost with how to use the "say_hello()" function.
I've tried:
use MyFunctions;
// instantiate class
$a = new basic();
// this gives me 'call to undefined function'
echo say_hello("Bob");
I've tried digging at other examples and I'm chomping at the bits trying to access this function. Could someone give me an example of how I would get to, and use, the "say_hello()" function from another file? Any help would be HUGELY appreciated, thanks!