PHP namespaces and classes with static functions

Should I use classes with static functions or namespaces to better organize a PHP project growing in size?

I come from the Java background and get static variables / functions.

+2
source share
2 answers

2 functions are completely different from each other.

A static keyword is to make a property or method available without an actual instance of the class. http://php.net/manual/en/language.oop5.static.php

Namespaces, on the other hand, are designed to be organized and avoid name collisions. http://www.php.net/manual/en/language.namespaces.rationale.php

+4
source

, static.. const.. , , , .

0

All Articles