Posted By: Tony Baird
Last Updated: Saturday February 16, 2008
I’ve been reading around the internet a lot recently about PHP 5.3 and how it is going to include a lot of the features there were slated for PHP6. I see it as an attempt to give users all the features they need because hosting providers were in no way going to upgrade to PHP6 once it was released until 6.1 came along or 6+ months later at the earliest. This of course does not apply to Hawk Host as we had plans on running PHP6 as an option (chooseable like PHP4 and PHP5 right now) as soon as PHP6 hits a point where there aren’t releases after few seconds. So most likely the first stable release or one of the more later release candidates.
So now you’re wondering what sort of features are going to be included? Well the biggest one for me is namespaces as right now you end up having silly function and class names so that you don’t end up with clashes between names. For example you may have MyApp_CreateUser because you don’t want to clash with another CreateUser.
Namespaces fixes this problem as you can just do the following:
[sourcecode language=‘php’] namespace MyApp; class CreateUser { …
[/sourcecode]
Then to call the CreateUser you can just do
[sourcecode language=‘php’] $createUser = new MyApp::CreateUser(); [/sourcecode]
Another option is to use the use keyword [sourcecode language=‘php’] use MyApp; $createUser = new CreateUser(); [/sourcecode]
It’s that easy or essentially like any other language. Of course you can do other things like namespace aliases which I’m not going to bother discussing a simple search you’ll find out how to do them. The next thing I found interesting was you can now have class constants which can be useful at a times. Right now it’s not an option so you’re stuff not using a constant.
Some other things I don’t feel like talking about feature wise:
- Late Static Binding - Variable static calls
Now for something that caught my eye was the fact a native MySQL driver will be included and I can just say finally! PHP and MySQL go hand and hand in almost every PHP configuration so it makes perfect sense. As a result of this native extension MySQL will benefit from a small increase in performance when dealing with PHP but by no means is it going to make it a speed demon.
This now just leaves us with the only thing I think could cause problems and that is E_STRICT being moved to part of E_ALL. Lots of applications have E_ALL set on right now that may not be fully strict compliant. Thankfully deprecated errors have been moved to E_DEPRECATED so hopefully very few if any applications will run into any problems.
Well that’s my thoughts on this PHP 5.3 coming up. It’s good to see some of these features hitting PHP5 as developers are not going to need to worry about well when will the users upgrade which happened with PHP4 to PHP5 migration. This should also mean a much smoother transition to PHP6. So I can’t wait!