mirror of
https://github.com/php/php-src.git
synced 2024-12-25 01:40:50 +08:00
25 lines
395 B
PHP
25 lines
395 B
PHP
--TEST--
|
|
Closure 012: Undefined lexical variables
|
|
--FILE--
|
|
<?php
|
|
$lambda = function () use ($i) {
|
|
return ++$i;
|
|
};
|
|
$lambda();
|
|
$lambda();
|
|
var_dump($i);
|
|
$lambda = function () use (&$i) {
|
|
return ++$i;
|
|
};
|
|
$lambda();
|
|
$lambda();
|
|
var_dump($i);
|
|
?>
|
|
--EXPECTF--
|
|
Notice: Undefined variable: i in %sclosure_012.php on line 2
|
|
|
|
Notice: Undefined variable: i in %sclosure_012.php on line 7
|
|
NULL
|
|
int(2)
|
|
|