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?

1 Answer 1

4

Sure, just use $$ for actual dollar sign.

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.