1--TEST-- 2Closure in static initializer 3--FILE-- 4<?php 5 6function foo() { 7 static $closure = static function () { 8 echo "called", PHP_EOL; 9 }; 10 11 var_dump($closure); 12 $closure(); 13} 14 15foo(); 16 17?> 18--EXPECTF-- 19object(Closure)#%d (3) { 20 ["name"]=> 21 string(17) "{closure:foo():4}" 22 ["file"]=> 23 string(%d) "%s" 24 ["line"]=> 25 int(4) 26} 27called 28