PHP closures and a quick Debian tip
Dave’s away and I get to indiscriminately litter his blog with posts, so I just wanted to mention something that got me a bit excited a few days ago.
I subscribe to the DevZone RSS feed so I get the (daily) Zend Weekly Summaries. A few days ago they reported on a conversation about anonymous functions. Now, you should really read TFA to get the full picture, but basically this is how anonymous functions (don’t) work in PHP at the moment:
< ?php $arr_plus_one = array_map(create_function("int", "return ++$int;"), $arr); ?>
Bollocks, right? Well the proposal is for a new syntax for this which would bring PHP much more in line with modern languages like JavaScript:
< ?php $arr_plus_one = array_map(function($int) { return ++$int; }, $arr); ?>
Much better, yeah? Well the discussion is really more about whether this function should become full-blown closure support in PHP, rather than just a new anonymous function syntax. I just wanted to put it out there and say that I strongly believe Zend should implement full closure support for PHP 6, even if the scoping rules are dodgy. I know newbies are going to be confused by the scoping rules at first but you don’t need to use closures if you don’t understand them. It will also bring PHP a lot closer to being a modern programming language. As it stands PHP is just a fluffy C with just as dodgy OOP. It’s great and I love it and don’t get me wrong I won’t write a web app in anything else, it’s just that it’s a bit frustrating writing beautiful JS and Python then having to go back to PHP
I mentioned Debian didn’t I? Here’s a quick tip that doesn’t warrant another post: If you administrate a bunch of Debian servers, look at the apticron package:
apticron report [Fri, 18 May 2007 06:25:09 +0100]
========================================================================apticron has detected that some packages need upgrading on:
ganesh.bronco.co.uk
[ 192.168.0.18 ]The following packages are currently pending an upgrade:
xfree86-common 4.3.0.dfsg.1-14sarge4
libice6 4.3.0.dfsg.1-14sarge4
libsm6 4.3.0.dfsg.1-14sarge4
libxext6 4.3.0.dfsg.1-14sarge4
libxt6 4.3.0.dfsg.1-14sarge4
libdps1 4.3.0.dfsg.1-14sarge4
xlibs-data 4.3.0.dfsg.1-14sarge4
libx11-6 4.3.0.dfsg.1-14sarge4
libxmu6 4.3.0.dfsg.1-14sarge4
libxpm4 4.3.0.dfsg.1-14sarge4
libxaw7 4.3.0.dfsg.1-14sarge4
smbfs 3.0.14a-3sarge6
samba 3.0.14a-3sarge6
samba-common 3.0.14a-3sarge6
samba-doc 3.0.14a-3sarge6
xterm 4.3.0.dfsg.1-14sarge4
xutils 4.3.0.dfsg.1-14sarge4
Sweet yeah? It also goes on to say exactly what the updates contain, which is great. Get it!




