xref: /PHP-5.5/Zend/tests/closure_009.phpt (revision bc12bc69)
1--TEST--
2Closure 009: Using static vars inside lambda
3--FILE--
4<?php
5$a = 1;
6$x = function ($x) use ($a) {
7  static $n = 0;
8  $n++;
9  $a = $n.':'.$a;
10  echo $x.':'.$a."\n";
11};
12$y = function ($x) use (&$a) {
13  static $n = 0;
14  $n++;
15  $a = $n.':'.$a;
16  echo $x.':'.$a."\n";
17};
18$x(1);
19$x(2);
20$x(3);
21$y(4);
22$y(5);
23$y(6);
24?>
25--EXPECT--
261:1:1
272:2:1
283:3:1
294:1:1
305:2:1:1
316:3:2:1:1
32