How can I dynamically create a php variable in a real PhpStorm template?

I am trying to create a live template in PhpStorm but I am having problems dynamically creating variables. I am trying to do something like this:

$$VARIABLE_NAME$ = function($END$)
{

};

$this->foo(array('$VARIABLE_NAME$' => $$VARIABLE_NAME$));

      

Let's say we enter "bar" for $ VARIABLE_NAME $, I want the following result:

$bar = function()
{

};

$this->foo(array('bar' => $bar));

      

Basically, I need a way to escape the $ VARIABLE_NAME $ so that it creates a php variable with the value you entered for it. Does anyone know how to do this?

+3


source to share


1 answer


Of course, just use $$

for the actual dollar sign.



This means that you must replace $$VARIABLE_NAME$

with$$$VARIABLE_NAME$

+3


source







All Articles