1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
DanielEScherzer a50f82bebf Zend/tests: organize some tests with sub directories (6) (#17807)
Move more tests into existing directories

Work towards GH-15631
2025-02-15 14:55:07 +00:00

42 lines
633 B
PHP

--TEST--
Allow defining Closures wrapped in an array in const expressions.
--FILE--
<?php
const Closure = [static function () {
echo "called", PHP_EOL;
}, static function () {
echo "also called", PHP_EOL;
}];
var_dump(Closure);
foreach (Closure as $closure) {
$closure();
}
?>
--EXPECTF--
array(2) {
[0]=>
object(Closure)#%d (3) {
["name"]=>
string(%d) "{closure:%s:%d}"
["file"]=>
string(%d) "%s"
["line"]=>
int(3)
}
[1]=>
object(Closure)#%d (3) {
["name"]=>
string(%d) "{closure:%s:%d}"
["file"]=>
string(%d) "%s"
["line"]=>
int(5)
}
}
called
also called