In this short article I’ll be covering what’s new and different in PHP 5. Although version 5 has been released for quite some time, people are still stuck in the previous version.
Hopefully you’ll finally migrate after reading this!
Seriously what’s up with pretty much every single server running PHP version 4, was searching for a good webhost that was offering PHP 5 , which I soon found out is like searching for the perfect woman…
Sure there are hosts that provide it, but there are some issues with this:
1. I have never ever heard about them, googling reveals nothing.
2. The price for the PHP 5 option is just ridiculous.
3. The host doesn’t offer anything good a part from the PHP 5.
Now why has this happened and why are people and most of the programming PHP community still stuck back a “generation”?
Well personally I think this all is our own faults, we just settled with PHP 4, it works well; most PHP web applications are not working in version 5 etc.
So frustrated I decided to make this post to show people what php5 is!
It’s a bigger and improved version that all too few use at the time I’m writing this post.
So what’s so different from php4?
The biggest change is the much improved support of OOP which is short for Object Orientated Programming which I was and still am very amped about, in php5 you can now pretty much code objects like in most other languages, so if you come from Java or C++ you’ll find the features that you are familiar with.
PHP5 now have object autoloading, destructors, visibility, static methods, class constants, type hinting, interfaces, cloning, reflection and several magic methods, which is a great improvement in my opinion.
This is good as OOP makes code structured, easy to use, categorized and in short improves the code and coding in general.
Many of this was already available in the previous version, but in php5 the support is much more complete!
Here’s a small list on what’s new in PHP5 except the OOP part:
Exceptions for maintainable, scalable error handling
If you’d programmed in a language similar to Java, the error handling and exceptions will be familiar, now you too can use the try{} and catch{} blocks.
Finally we can take control over the ugly errors appearing in php!
SimpleXML for easy handling of XML
Now the XML functions are fully WC3 standards compatible, now working with XML files will get easier, smoother and not as ugly as before.
Also DOMXL is replaced with just the DOM extension, you won’t have to work on the experimental version of PHP anymore to use it.
SPL, exception and interior handling
SPL is a library, that is new in php5, which basically is collection of objects built to handle exception handling and object traversal.
Which I have found very useful;
DirectoryIterator and RecursiveDirectoryIterator;
Classes that allow iterator based directory traversal and eliminates the need for messy directory handles.
SimpleXMLIterator; Provides iteration over a simplexml object.
ArrayObject and ArrayIterator;
Provide an array object as well as an object to traverse the contents of an array without making assumptions on the way the array is storing it’s internal data.
There are some other interiors and objects that I don’t remember, mostly because I don’t work with them so much as with the mentioned ones.
But check the php5 documentation to get more detailed information regarding what more is available.
…
If more people would migrate to php5 the developers of popular web application would have to migrate as well. Why many don’t release a php5 version is that it’s a money issue, as long as people use the current one they most likely won’t bother with upgrading their product.
Also more people demanding php5 would spawn in webhosts upgrading and at least offering better services than the current ones, that I’m quite disappointed with right now.
The technology evolves, new and better versions appear, getting stuck in a specific version isn’t good in my opinion, I mean what would have happened if people would have settled with the technology we had in the 70s and didn’t care about all the new that came out?
Do you get what I’m trying to say?
So at least try php5 out, hopefully you’ll migrate to it before I write the post on why to migrate to php6.










[…] PHP version 5 has very well designed object-oriented features. If you’re not using PHP 5 yet I strongly recommend reading my post on why to use PHP 5. […]
10 reasons why I use PHP » Krillz.com
September 17th, 2007