Should I use classes with static functions or namespaces to better organise a PHP project growing in size?
I come from a Java background and like having static variables/functions available.
The 2 features are completely different from each other.
The static keyword is to make a property or method available without an actual class instance. http://php.net/manual/en/language.oop5.static.php
On the other hand Namespaces are for organization and avoiding naming collisions. http://www.php.net/manual/en/language.namespaces.rationale.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With