mirror of
https://github.com/php/php-src.git
synced 2024-12-15 12:54:57 +08:00
02bd52b5a8
https://wiki.php.net/rfc/dynamic_class_constant_fetch Closes GH-9793
25 lines
455 B
PHP
25 lines
455 B
PHP
--TEST--
|
|
Dynamic class constant fetch in constant expressions
|
|
--FILE--
|
|
<?php
|
|
|
|
class Foo {
|
|
public const BAR = 'bar';
|
|
public const BA = 'BA';
|
|
public const R = 'R';
|
|
public const CLASS_ = 'class';
|
|
public const A = self::{'BAR'};
|
|
public const B = self::{'BA' . 'R'};
|
|
public const C = self::{self::BA . self::R};
|
|
}
|
|
|
|
var_dump(Foo::A);
|
|
var_dump(Foo::B);
|
|
var_dump(Foo::C);
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(3) "bar"
|
|
string(3) "bar"
|
|
string(3) "bar"
|