php concatenating string to classconstant in array assignment

following doesn't work:

<?php
class test{
    const t = 10;
    public static $y = array('t' => self::t . 'hello');
}
var_dump(test::$y);
?>

can somebody tell me why that is? :)

it fails in the ... => self::t . 'hello')... part, where it, as seams, not is able to concatenate a classconstant in the array().

that implies that both of following works perfect:

public static $y = array('t' => self::t);

and

public static $y = array('t' => 'hello');

Answers


can somebody tell me why that is?

Concatenation is a product of run-time. Class member initial values must be known at parse time.


Need Your Help

Style Paths In Java EE Applications

java html css path

I have a Java EE application and in the application I have the following structure.

AJAX Masked Textbox custom mask

c# jquery asp.net web ajaxcontroltoolkit

I have a slider on my page and I want to set it up so that when the user slides (which is in minutes) it displays a 'pretty' version of the current selection. So, for example, if the slider is on '...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.