Crucial Paradigm Australia Official Blog
php
It’s been a while since I’ve posted anything but I thought I would write something “coding wise” beneficial.. (you know, because I never talk about anything “important”)
So today I thought I might provide an example that hasn’t (in my opinion) been that well explained on the internet, this my friends is PHP-OOPs lost feature “interfaces”
(Note: not so much as “lost” feature but lets face it, every semi php programmer knows basic OOP but they may not know about things like abstraction or interfaces, it’s very much a hidden feature)
Ahoy!
Okay so want to know something I hate? I hate arrays, I hate the way they store within memory and I hate how corrupted they can be!
You want to know what I love? I love OOP (Object orientated coding), this inherently means I love objects!
So without further ado, lets get rid of all those arrays coming into your data matrix and replace them with objects… (oooooooh!)
Hey folks,
Before I go on, this isn’t a rant its a learning experience… I swear
PHP is one of those languages that has a very relaxed nature to it, this allows the novice people to pick it up quickly and generally get the work smacked out faster than others.
But as the great comic book writer Stan lee once said “With great power comes great responsibility”…
The reason I use this quote is mainly due to the fact that with the great power and flexibility PHP provides you; you will need to be time and time again reminded of coding best practices and the standards that entwine any programing language, even more so the methodologies and paradigms used by you.
One of these problems surfaces itself brutally in OOP (Object Orientated Programming).
Gzip can reduce page size by an impressive amount, especially for high traffic sites. We have optimised some of customers sites receiving high traffic and have easily been able to reduce bandwidth usage by 60-80%.
If you have zlib compiled into PHP and you are running PHP then the easy way to enable gzip compression is to add the following line to your .htaccess file:
php_value output_handler ob_gzhandler
This will only enable gzip compression on PHP, and not on css, javascript, html, etc files – this needs to be done in the apache config file.



