title: Can I set variable value by name in another variable in PowerShell
body: <p>In <em>PHP</em> I can write that code:</p>
  <pre><code>$var = 1;
  $name = 'var';
  $$name = 2;
  echo &quot;var = $var&quot;;
  </code></pre>
  <p>Result: <code>var = 2</code></p>
  <p>How can I do things like that in PowerShell?</p>
  <p>I tried:</p>
  <ul>
  <li><code>$$name = 2</code><br />
  <code>Unexpected token 'name' in expression or statement.</code></li>
  <li><code>${$name} = 2</code><br />
  Creates variable with name <strong>$name</strong></li>
  </ul>