PHP Conference, day 1

Today was the first day of the PHP Conference in Amsterdam. I attended the highly interesting full-day session by Laura Thomson and Luke Welling on PHP5 and MySQL best practices. It turned out to be an excellent choice. Thanks to this presentation I've 'discovered' the really cool mysqli extension that harnesses the full power of MySQL 4.1 under PHP5. In fact my hands were itching to try it out when I got home. The OO interface really shines. If you haven't checked it out yet you definitely should! I planned to write more about today than you'll find when you click the more-link but unfortunately the presentation they gave isn't yet available online yet and I didn't take my own notes. (stupid!). I'll dive into some of the more interesting issues in more depth when I've toyed around with them a bit more. For now just some random notes on the session.
This piece of code actually creates THREE (!) objects due to the pass-by-value characteristics of PHP4. The first two objects are created when we instantiate a someClass object. One is $a and one is wel ehm... immediately lost, but created nevertheless. When we assign $a to $b yet another copy is created. Thank god for pass-by-reference in PHP5, like it should. Bye bye PHP4, rest in peace. Let's hope Zend will hurry with the PHP5 certification program.
Did I mention mysqli is really cool? Especially the prepared statements are simply awesome.
A nice example from the php manual:
prepare("SELECT District FROM City WHERE Name=?")) { /* bind parameters for markers */ $stmt->bind_param("s", $city); /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($district); /* fetch value */ $stmt->fetch(); printf("%s is in district %s\n", $city, $district); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?>
Just lovely! The prepared statement functionality can dramatically speed up long series of the same query since it's only sent to the database once and then run many times. An added bonus is the very nice protection against SQL injection. Definitely worth a look.
In the afternoon a lot of powerful features of MySQL 4.1 and 5.0 were discussed. I've seen it's about time I caught up with stuff like the transactions, query cache, more on prepared statements, subqueries and many other excellent features. The presentation by Laura and Luke will be online in downloadable format in a couple of days. I'll update this posting when it becomes available!
Tomorrow I plan to bring my powerbook to the conference and I'll try to do some blog post directly from the PHP conference. Stay tuned!
Filed under: programming
Number of comments:
Number of trackbacks:
Tagged with: 







At 02 May '05 - 23:55 Max wrote:
At 03 May '05 - 11:44 stefan wrote:
You should come and say hi at the php usergroup stand, of course… and immediately become a member ;)