summaryrefslogtreecommitdiff
path: root/Zend/tests/list_keyed_non_literals.phpt
blob: 7c6afe70b74afb39486b0ac022fe279dac9c4228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--TEST--
list() with constant keys
--FILE--
<?php

$arr = [
    1 => "one",
    2 => "two",
    3 => "three"
];

const COMPILE_TIME_RESOLVABLE = 1;

define('PROBABLY_NOT_COMPILE_TIME_RESOLVABLE', file_get_contents("data:text/plain,2"));

$probablyNotCompileTimeResolvable3 = cos(0) * 3;

list(
    COMPILE_TIME_RESOLVABLE => $one,
    PROBABLY_NOT_COMPILE_TIME_RESOLVABLE => $two,
    $probablyNotCompileTimeResolvable3 => $three
) = $arr;

var_dump($one, $two, $three);

?>
--EXPECT--
string(3) "one"
string(3) "two"
string(5) "three"