Skip to content
Advertisement

Tag: namespaces

How to call PHP a class from parent namespace?

I have the following namespace structure with the following class files So in App.php I’ve declared in Startp.php declared in Plugin.php declared I see that I can call the Plugin.php class from the App.php like if it’s a child/grandchild namespace, but what if I want to call Process.php from Plugin.php, which is the parent namespace from the branch? Is there

php – check if class name stored in a string is implementing an interface

I understand that my question is somehow wrong, but I’m still trying to solve this problem. I have an interface Programmer: and a couple of namespaced classes: StudentsBjarneProgrammer (implements Programmer) StudentsCharlieActor (implements Actor) I have this class names stored in array $students = array(“BjarneProgrammer”, “CharlieActor”); I want to write a function, that will return an instance of class if it’s

Advertisement