Creating a variable with $ sign in front in PHP file template

Answered

I have what should be a really easy thing to do, but I'm stumped. I've created a simple PHP file template that is meant to create within the Class a static array to hold all the instances of the array. For simplicity sake, I'm creating a class called State which will have a static array to hold all of the State instances.

I want the end result to be

     public static $StateList = array();

I first tried the following:

    public static ${NAME}List = array();

But that produced:

     public static StateList = array();

I've tried $${NAME}List, \$${NAME}, $\${NAME} but none of those work.

How do I do this simple task? (I'm using PHP 2018.1.6 on the Mac).

 

Stephen

1 comment

Hi there,

${NAME} suggests that it's a File Template. If I'm correct -- just use ${DS} predefined variable.

https://www.jetbrains.com/help/phpstorm/file-template-variables.html#predefined_template_variables

 

P.S. In Live Templates that would be $$

1

Please sign in to leave a comment.