1--TEST-- 2Constant expressions with null coalescing operator ?? 3--FILE-- 4<?php 5 6const A = [1 => [[]]]; 7 8const T_1 = null ?? A[1]['undefined']['index'] ?? 1; 9const T_2 = null ?? A['undefined']['index'] ?? 2; 10const T_3 = null ?? A[1][0][2] ?? 3; 11const T_4 = A[1][0][2] ?? 4; 12const T_5 = null ?? __LINE__; 13const T_6 = __LINE__ ?? "bar"; 14 15var_dump(T_1); 16var_dump(T_2); 17var_dump(T_3); 18var_dump(T_4); 19var_dump(T_5); 20var_dump(T_6); 21 22var_dump((function(){ static $var = null ?? A[1]['undefined']['index'] ?? 1; return $var; })()); 23var_dump((function(){ static $var = null ?? A['undefined']['index'] ?? 2; return $var; })()); 24var_dump((function(){ static $var = null ?? A[1][0][2] ?? 3; return $var; })()); 25var_dump((function(){ static $var = A[1][0][2] ?? 4; return $var; })()); 26 27var_dump((new class { public $var = null ?? A[1]['undefined']['index'] ?? 1; })->var); 28var_dump((new class { public $var = null ?? A['undefined']['index'] ?? 2; })->var); 29var_dump((new class { public $var = null ?? A[1][0][2] ?? 3; })->var); 30var_dump((new class { public $var = A[1][0][2] ?? 4; })->var); 31 32?> 33--EXPECTF-- 34int(1) 35int(2) 36int(3) 37int(4) 38int(%d) 39int(%d) 40int(1) 41int(2) 42int(3) 43int(4) 44int(1) 45int(2) 46int(3) 47int(4) 48