xref: /PHP-7.4/Zend/tests/closure_001.phpt (revision 782352c5)
1--TEST--
2Closure 001: Lambda without lexical variables
3--FILE--
4<?php
5
6$lambda1 = function () {
7	echo "Hello World!\n";
8};
9
10$lambda2 = function ($x) {
11	echo "Hello $x!\n";
12};
13
14var_dump(is_callable($lambda1));
15var_dump(is_callable($lambda2));
16$lambda1();
17$lambda2("Universe");
18call_user_func($lambda1);
19call_user_func($lambda2, "Universe");
20
21echo "Done\n";
22?>
23--EXPECT--
24bool(true)
25bool(true)
26Hello World!
27Hello Universe!
28Hello World!
29Hello Universe!
30Done
31