Jun 30: PHP 5.3 is released

It was a long run and I'm sure it felt like an eternity for many - for me it certainly did. PHP 5.3 was branched of over two years ago and finally is ready to be called 5.3.0.
The php.net website and many other blogs discuss the features - from often loved closures, to well discussed namespaces to the sometimes hated goto - so I think I don't have to this here but instead can focus on that what really matters:
- Thanks to all the developers - Without them no new features would be there.
- Thanks to the documentation team - Without them one would have to decipher the NEWS file and guess what exactly is meant.
- Thanks to all participants during the Testfest! - During the Testfest we received many good tests for our regression test suite. Many of these tests represent what people do, not what developers think they should do which is important to reduce the risk of regressions. I hope people don't stop sending tests!
- Thanks to all the testers who reported bugs, and to the ones who reported that their applications worked without issues! - Regression tests are important but many possible issues can only be found in real life scenarios with real applications.
- Thanks to the whole community to make pressure on the developers to finally get it out as everybody is waiting for the new features.
- And last, but certainly not least: Thanks to Lukas! - Handling developers who are passionate for their work can be tough. Lukas made sure that the developers focus on what really matters and really helped me with all the work needed
So with that: In case you didn't do already: Browse over to php.net and grab your copy, it's for free!
If you want to celebrate the release and are close to Munich: We're planing a PHP Release Party on July 17th, details on that will follow.
Jun 19: MySQLi Resultset Iterator


Over at phpdeveloper.org I was pointed to a blog post talking about MySQLi and stored procedures. That reminded me about a small thing I recently did: When using MySQLi's multi_query to send queries which return multiple result sets you have to use a rather unintuitive API which can certainly be improved.
Recently I sat down and cooked up a small improvement for that, being an iterator fan I, of course, had to use an iterator for that and implemented the following class:
<?php class MySQLi_ResultsetIterator implements Iterator { private $mysqli; private $counter = 0; private $current = null; private $rewinded = false; public function __construct(mysqli $mysqli) { $this->mysqli = $mysqli; } private function freeCurrent() { if ($this->current) { $this->current->free(); $this->current = null; } } public function rewind() { if ($this->rewinded) { throw new Exception("Already rewinded, rewinding multiple times is not allowed!"); } $this->freeCurrent(); $this->counter = 0; $this->rewinded = true; } public function valid() { $this->current = $this->mysqli->store_result(); return (bool)$this->current; } public function next() { $this->freeCurrent(); $this->counter++; $this->mysqli->next_result(); } public function key() { return $this->counter; } public function current() { if (!$this->current) { throw new Exception("valid() not called"); } ?>
This iterator is wrapping all that's needed an then can be used like that:
<php $mysqli = new MySQLi("localhost", "root", "", "test"); $query = "SELECT 1,2 UNION SELECT 3, 4;". "SELECT 'hi world' UNION SELECT 'foobar'"; if ($mysqli->multi_query($query)) { foreach (new MySQLi_ResultsetIterator($mysqli) as $key => $result) { echo 'MySQL Resultset #'.(1+$key).":\n"; while ($row = $result->fetch_row()) { printf(" %s\n", $row[0]); } } } ?>
The output will be something like
MySQL Resultset #1: 1 3 MySQL Resultset #2: hi world foobar
And is, in my opinion, way nicer than the classical way, which you can see on the multi_query docs page.
That code is the first revision of that idea, I'll try to improve it and port it over to C so that some future version of PHP will include it. As a disclaimer: If you plan on using this class be aware that a future PHP might bundle a class having that exact name so use your own name Feedback welcome.
Jun 16: PHP BBQ Munich

Yesterday we held our PHP BBQ event at Munich, well it was no BBQ as the weather forecasts predicted rain,which came in the evening, but a nice evening in a beer garden.
We had more than 30 people there, some leaving early, sme arriving late, covering quite different kinds of participants: PHP core developers, professional PHP users, people doing PHP stuff as hobby, friends and PHP community veterans like Till Gerken. Many people didn't know each other or didn't see each other or some time so we had lot's of discussions, and most of them even weren't about PHP and even many non-IT things were covered, which I find always great. If you want an impression check Ulf's photos. I really hope this makes a good foundation for more regular PHP meetups.
There will be a few more events of this kind this week in Germany, so go there if you can, don't be shy and have fun.
PHP BBQ dates:
- Tuesday, 16.06.2009: Frankfurt
- Wednesday, 17.06.2009: Karlsruhe
- Thursday, 18.06.2009: Berlin
- Friday, 19.06.2009: Dortmund
- Saturday, 20.06.2009: Hamburg
- Sunday, 21.06.2009: Kiel