Quantcast
Channel: Spiceworks Community
Viewing all articles
Browse latest Browse all 39

Practical PHP OOP Examples?

$
0
0

JoeyH3 wrote:

Edit: I missed the last paragraph of your post, where you addressed exactly what I said. While having self-referencing could be nice, is there any standard or best practice that says functions shouldn't be named like that?

No, but with large projects it can become pretty bad, so for example a really old project I had functions with names like:

accounting_receivable_invoices_items_add(...)

But now i'd have a name space for Accounting\Receivable\Invoices and have a class name Items, and in there have add(). This is more organized. In fact this isn't the longest, I remember one was up to 47 characters, but this was a very, very large project.

Another benefit though, the one I like most, is autoloading, so if you reference a class it will automatically include the file, you don't need 9,000 includes at the top of all of your...


Viewing all articles
Browse latest Browse all 39

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>