Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP static variables in double quotes

How can I get PHP to evaluate a static variable in double quotes?

I want to do something like this:

log("self::$CLASS $METHOD entering"); 

I've tried all sorts of {} combos to get the variable value of self::$CLASS, but nothing has worked. I've currently settled with string concatenation but it is a pain to type:

log(self::$CLASS . " $METHOD entering"); 
like image 767
Chris Avatar asked Aug 12 '09 15:08

Chris


1 Answers

Sorry, you can't do that. It only works for simple expressions. See here.

like image 120
Electro Avatar answered Sep 23 '22 23:09

Electro