1--TEST-- 2Constant expressions with arrays 3--FILE-- 4<?php 5const a = [1,2,[3,[4]]]; 6const b = a[0]; 7const c = a[2][0]; 8const d = a[2]; 9const e = ["string" => [1]]["string"][0]; 10 11var_dump(b, c, e); 12 13function test ($a = d[1][0]) { 14 var_dump($a); 15} 16 17test(); 18 19class foo { 20 const bar = [1][0]; 21} 22 23var_dump(foo::bar); 24 25var_dump(a, a[0], a[2], a[2][1], a[3]); 26 27?> 28--EXPECTF-- 29int(1) 30int(3) 31int(1) 32int(4) 33int(1) 34 35Warning: Undefined array key 3 in %s on line %d 36array(3) { 37 [0]=> 38 int(1) 39 [1]=> 40 int(2) 41 [2]=> 42 array(2) { 43 [0]=> 44 int(3) 45 [1]=> 46 array(1) { 47 [0]=> 48 int(4) 49 } 50 } 51} 52int(1) 53array(2) { 54 [0]=> 55 int(3) 56 [1]=> 57 array(1) { 58 [0]=> 59 int(4) 60 } 61} 62array(1) { 63 [0]=> 64 int(4) 65} 66NULL 67