Class constant in a string in PHP

Viewed 10757

My reading of the manual (the bit just before the section heading "String access and modification by character") is that you can do some fancy tricks with class constants and {} inside a string but you can't do the simple thing that would make this method return the truth:

class c {
    const k = '12';
    public function s() {
        return "Twelve in decimal is {c::k}.";
    }
}

Is the right solution here to concatenate?

3 Answers
Related