<?php
$closures = array();
$simple_closure = function() { return 'hello world';};
for ($x=0; $x < 2; $x++) {
$closures[$x] = $simple_closure;
}
$obj1 = new stdClass;
$obj1->color = "red";
$obj2 = new stdClass;
$obj2->color = "blue";
$c1 = Closure::bind($closures[0], $obj1);
$c2 = Closure::bind($closures[1], $obj2);
var_dump($c1,$c2);
print "<span style='$obj1->color'>",$c1(),'</span>';
print "<span style='$obj2->color'>",$c2(),'</span>';
- Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.22
- Parse error: syntax error, unexpected ',' in /in/0dNhp on line 22
Process exited with code 255.
preferences:
187.45 ms | 1395 KiB | 58 Q