xref: /PHP-8.1/Zend/tests/closure_012.phpt (revision 36935e42)
1--TEST--
2Closure 012: Undefined lexical variables
3--FILE--
4<?php
5$lambda = function () use ($i) {
6    return ++$i;
7};
8$lambda();
9$lambda();
10var_dump($i);
11$lambda = function () use (&$i) {
12    return ++$i;
13};
14$lambda();
15$lambda();
16var_dump($i);
17?>
18--EXPECTF--
19Warning: Undefined variable $i in %s on line %d
20
21Warning: Undefined variable $i in %s on line %d
22NULL
23int(2)
24