summaryrefslogtreecommitdiff
path: root/Zend/tests/array_unpack/ref1.phpt
blob: 2f0966ae2d9dbd08a7d7a79a3afd5940a17d3b8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--TEST--
Array unpacking with element rc=1
--FILE--
<?php

$a = 1;
$b = [&$a]; //array (0 => (refcount=2, is_ref=1)=1)

unset($a); //array (0 => (refcount=1, is_ref=1)=1)

var_dump([...$b]); //array (0 => (refcount=0, is_ref=0)=1)

?>
--EXPECT--
array(1) {
  [0]=>
  int(1)
}