Archives For php6

In the third edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide” book, titled “PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide“, I went out on a limb and used a beta version of PHP 6 when writing the book. PHP 6 was about half-way done at the time, and I didn’t want to complete the book, only to have it be outdated immediately thereafter (using PHP 6 wasn’t, by the way, an attempt to trick the reader into buying the book, as some cynical people have suggested). Well…PHP 6 ended up dying due to many complications and I had the proverbial egg on my face (what one reader rightfully called my “Dewey Defeats Truman” moment). In truth, only about 5% of the book or so required PHP 6, so it wasn’t a devastating mistake, but I certainly felt foolish.

One of the things I wanted to cover in PHP 6 was locale-aware date and time formatting, as part of the goal of PHP 6 was to recognize the more global Web environment. Even though PHP 6 was shelved, the key components have since been integrated into PHP 5.2, 5.3, and the forthcoming 5.4. Locale-aware date and time formatting was demonstrated in the book using the PHP 6 date_format_locale() function. That function went belly-up, and PHP 5.3 now has the IntlDateFormatter class instead. The documentation for the class in poor, but here’s what I figured out…

Continue Reading…

PHP6 to PHP5.4

January 10, 2012

In early 2012, the official release of PHP5.4 is expected (it’s currently in its fourth release candidate stage). PHP5.4 completes many of the additions that were planned for PHP6 (several others, such as namespaces, were added in PHP5.3). Along with the additions, many of the features that have been deprecated in PHP and were set to be removed in version 6.0 are now being removed in 5.4 instead, such as PHP’s Safe Mode.

The main reason I wanted to use PHP6 when I wrote the third edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide” book is the intended support for Unicode. I had not seen this before, but I guess the attempted move to Unicode resulted in PHP scripts requiring twice as much memory as before, with a noticeable lag in performance. This is why the developers had to scrap those plans. But PHP 5.4 has “inline support” for several new languages, including Japanese and some dialects of Chinese. In other words, PHP5.4 has kind of a Unicode-light support. This Unicode support won’t be activated unless specified during the installation process.

I’m not sure where this leaves actual PHP6, but PHP5 is certainly a most excellent tool in its own right. I did use PHP5.3 in the fourth edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide” book, and will make use of PHP5.4 in the third edition of my “PHP 5 Advanced: Visual QuickPro Guide”, due out later this year.

 

In this edition…

Continue Reading…

About two months ago, Johannes Schlüter posted about the Future of PHP 6. Schlüter works for MySQL (and therefore Oracle-Sun) and is an active and involved member of the PHP team. In his post, Schlüter discusses the difficult choices facing PHP with respect to the intended version 6 and its support for Unicode. In turns out that changing all of PHP to support Unicode isn’t as easy as one would have thought. And, of course, it was originally considered to be, well, hard. Apparently, this struggle is the reason PHP 6 is still nowhere to be found (in fact, the source code has slowly been disappearing from PHP’s snaps site). So now, the PHP team is regrouping in order to go forward and we’re not exactly sure when or how Unicode support will be integrated into PHP, or how this change affects the next few versions of PHP, both minor (i.e., 5.3) and major (6 and 7).

As a person that wrote a book on PHP 6 quite some time ago, and has looked more and more silly over time, I’m happy to hear this news, even if we don’t yet know what the end result will be. Granted, most of that book uses PHP 5 and PHP 6 (the version that was available when I wrote it) is only required by like 5-10% of the material, but still…lesson learned on my part: especially when it comes to open source software, there’s just no predicting what’s going to happen next. So, for the time being, let’s be happy with the PHP we have and keep an eye on where the development team goes with this. I know I sure will!

The makers of EasyPHP, an all-in-one Apache, PHP, and MySQL installer for Windows, also provides a PHP 6 version if you’re interested in experimenting with the next major version of the language (as I demonstrate in my PHP 6 and MySQL 5 for Dynamic Web Sites book). I haven’t personally used EasyPHP (I try to avoid using Windows, if at all possible), but from what I can tell it seems to be a quality, well-supported product. EasyPHP is available for free although donations are encouraged.