Skip to content
Advertisement

php extended class in namespace refactor

I have made a class inside a namespace which is working perfectly fine but I think the code can be better. Right now I have to use a ‘/’ for every object inside the class which is not the best thing to do I assume.

JavaScript

}

Is it possible to do something like this? So I dont have to use a ‘/’ for every object but just for the class itself.

JavaScript

I tried to do some research on Google however the only thing I can find is: https://www.w3schools.com/php/php_namespaces.asp and here is not explained how to do such thing.

Advertisement

Answer

My prefered way is this:

JavaScript

As usual, w3school had provided ugly and oldscholl code.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement