PHP static variables in double quotes

后端 未结 9 1563
礼貌的吻别
礼貌的吻别 2020-11-29 08:16

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");
         


        
9条回答
  •  温柔的废话
    2020-11-29 08:50

    //define below
    function EXPR($v) { return $v; }
    $E = EXPR;
    
    //now you can use it in string
    echo "hello - three is equal to $E(1+2)";
    

提交回复
热议问题