Forum Moderators: coopster
Some of the key features of PHP 5 include:The Zend Engine II with a new object model and dozens of new features. XML support has been completely redone in PHP 5, all extensions are now focused around the excellent libxml2 library (http://www.xmlsoft.org/). A new SimpleXML extension for easily accessing and manipulating XML as PHP objects. It can also interface with the DOM extension and vice-versa. A brand new built-in SOAP extension for interoperability with Web Services. A new MySQL extension named MySQLi for developers using MySQL 4.1 and later. This new extension includes an object-oriented interface in addition to a traditional interface; as well as support for many of MySQL's new features, such as prepared statements. SQLite has been bundled with PHP. For more information on SQLite, please visit their website. Streams have been greatly improved, including the ability to access low-level socket operations on streams. And lots more...
changelog [php.net]
I wouldn't, sounds painful, different boxes, fine.
>> And how long before my webhosts upgrade?
1 - 5 yrs I would guess ;)
>> Is it 100% backward compatible with PHP4?
as far as I know it should be, I will tell you if I have any horror stories.
varkeyword. So, in
STRICTerror_reporting mode, something like this...
class myClass {
var $days = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
... Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in ...
Just a heads up for those going down this road.
A good resource regarding this:
[zend.com...]
The fantastic thing about PHP is that it is extremly common. Every webhosting company out there offers your standard L.A.M.P. server. If I write a web application, and I need a new server, or I switch to a new host, or whatever the situation may be, I know that my project is extremly mobile. I can switch my PHP/MySQL apps to a new server in less than an hour.
If PHP 5 isn't immediatly adopted and quickly becomes part of the ever common LAMP platform, then using it is pointless. If I need to dramaticly reconfigure my server to use PHP5, and I can't easily migrate to another server without a load of trouble, then why shouldn't I use Python, or Ruby, or even a custom web server in C++? If I am going to do the work for an uncommon configuration and limit myself to only custom configured machines, why not just make the jump to a better technology?
PHP 5 is of course nessicary in order to keep PHP modern, but it could also bring a quicker death to PHP.
Yes, but if you want to use PHP 5 features, then PHP is no longer ubiquitious.
And if you want to use PHP4 only functions, they won't work in PHP3. Some recent additions to PHP4 won't work in earlier versions of PHP4. Such is life. To add anything to PHP means a previous version won't work with whatever is added. What can we do. Some servers are still on versions of PHP pre-the change to register_globals being off by default. I imagine if they were to upgrade, many users' scripts would fail (unless they used
$variable = $_GET['variable']; at the head of their pages).
The big question is will it work in PHP5.0.0
If you use new features you can never expect that it will work with other versions.
To get around this I've used function_exists() and if it doesn't I create a small hack function that does the job. Off the top of my head I can't remember what I needed to do this for but a new (and simple) function was created in newer versions of PHP but for backwards compatibility I wrote a PHP function to do the same and the built in function and only created it if it didn't exists.
Anways that's something different, Trying to get new code to run on old version you should expect to have issues.
Running old code on new versions you should expect to have it work :)
Is it possible to run PHP 4 and PHP 5 on the same machine at the same time using different extensions?
Not a big problem at all. I've had 3 or 4 different versions of php going before. You just need to have a separate apache install for each php install. The trick is more in getting your httpd.conf files right. If you want to test php 5 try having your new apache install listen to a different ip address or port (ie 8080).
Running old code on new versions you should expect to have it work
I hadn't thought of it the other way round. There could be problems with PHP5 then as it introduces new (replacement) things like the new Zend engine and XML parser.
Again, it's a case of having to accept this in the name of improvements. It's like you can't expect your VCR tapes to play in a DVD player.
The PHP online manual is handy for finding alternative scripts when new features aren't available. Often I've seen users post workarounds for missing features.
Ideally a multi-function script might be written that queries the version of PHP and uses the correct script to match. Now that would be compatibility!
Timotheos:
You ask a tough question, and you'll get a million different answers, but I'll give you my take on it. I've been running the beta with little or no issues so far. (First off, why subject yourself to beta? Well, to help further the development for one, but that's a whole new thread). The best reasons to migrate to any new release will not just be feature-set, although that can often be a driving factor. As a matter of fact, that is often what drives new releases -- a customer has a requirement that they forward to development and the dev team says, "yeah, we should add that to our product in the next release". The dev team gets it ready and does a beta release. Customer realizes it is "ready" and puts the beta in place to start using the new feature. Bugs get worked out, etc. and eventually a version release is approved and published. Does that mean you or I should get on that release? Not really, not if I don't need the feature. If there were security updates or performance enhancements that tickled our fancy, now that would alter our decision-making quite drastically. However, with any software upgrades or rollouts, you really need to assess the changes and the impact to your particular installation before anything else. Then if the decision is to implement the upgrade, you first need to test, test, test before GO LIVE. That said, the single area that I would take under serious consideration for anybody using PHP objects is going to be in the area of the New Object Model, as I mentioned earlier. The Zend article states that PHP's handling of objects has been completely rewritten, allowing for better performance and more features.