mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
26 lines
270 B
PHP
26 lines
270 B
PHP
--TEST--
|
|
Closure 024: Clone the Closure object
|
|
--FILE--
|
|
<?php
|
|
|
|
$a = 1;
|
|
$c = function($add) use(&$a) { return $a+$add; };
|
|
|
|
$cc = clone $c;
|
|
|
|
echo $c(10)."\n";
|
|
echo $cc(10)."\n";
|
|
|
|
$a++;
|
|
|
|
echo $c(10)."\n";
|
|
echo $cc(10)."\n";
|
|
|
|
echo "Done.\n";
|
|
?>
|
|
--EXPECTF--
|
|
11
|
|
11
|
|
12
|
|
12
|
|
Done.
|