3

I'm trying to create a live template in PhpStorm but I'm having trouble with dynamically creating variables. I'm trying to do something like this:

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

};

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

Let's say that we type in 'bar' for the $VARIABLE_NAME$, I want to get the following result:

$bar = function()
{

};

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

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

Rich McCluskey
  • 1,871
  • 2
  • 18
  • 30

1 Answers1

4

Sure, just use $$ for actual dollar sign.

This means that you have to replace your $$VARIABLE_NAME$ by $$$VARIABLE_NAME$

LazyOne
  • 158,824
  • 45
  • 388
  • 391