xref: /PHP-8.0/Zend/tests/static_variable.phpt (revision f8d79582)
1--TEST--
2Static Variable Expressions
3--FILE--
4<?php
5const bar = 2, baz = bar + 1;
6
7function foo() {
8    static $a = 1 + 1;
9    static $b = [bar => 1 + 1, baz * 2 => 1 << 2];
10    static $c = [1 => bar, 3 => baz];
11    var_dump($a, $b, $c);
12}
13
14foo();
15?>
16--EXPECT--
17int(2)
18array(2) {
19  [2]=>
20  int(2)
21  [6]=>
22  int(4)
23}
24array(2) {
25  [1]=>
26  int(2)
27  [3]=>
28  int(3)
29}
30