1--TEST-- 2Dynamic class constant fetch in constant expressions 3--FILE-- 4<?php 5 6class Foo { 7 public const BAR = 'bar'; 8 public const BA = 'BA'; 9 public const R = 'R'; 10 public const CLASS_ = 'class'; 11 public const A = self::{'BAR'}; 12 public const B = self::{'BA' . 'R'}; 13 public const C = self::{self::BA . self::R}; 14} 15 16var_dump(Foo::A); 17var_dump(Foo::B); 18var_dump(Foo::C); 19 20?> 21--EXPECT-- 22string(3) "bar" 23string(3) "bar" 24string(3) "bar" 25