on Sep 18th, 2008PHP 5.3 and closures

<?php
function test() { return function() { echo "foo"; }; }
test()(); // fails
$func = test(); $func(); // works

Why, oh why!

2 Responses to “PHP 5.3 and closures”

  1. Ninhon 18 Sep 2008 at 8:18 pm

    My guess is that the parser can’t handle it, i.e. the PHP 5.3 grammar doesn’t account for this.

  2. Fredrik Holmströmon 18 Sep 2008 at 9:15 pm

    Ninh; Yeah, I even know why it’s just frekin’ annoying - was really looking forward to closures in 5.3

Trackback URI | Comments RSS

Leave a Reply