title: POST variable in array's name php
body: <p>I don't manage to get this piece of code working. I need to get an array depending of the variable posted. I guess it's obvious but I can't find the slution.</p>
  
  <pre><code>$choice1 =
      array (
          'order' =&gt; array (1,2,3,4,5),
              'settings' =&gt; (1,0,1)
      );
  $choice2 =
      array (
          'order' =&gt; array (1,5,3,2,4),
              'settings' =&gt; (0,0,0)
      );
  if(isset($_POST['choice'])) {
      $template_to_get = $_POST['choice'];
      $order_display = $template_to_get['order'];          // Here is the problem
      echo json_encode(array('order' =&gt; $order_display));
  }
  </code></pre>
  
  <p>Also tried:</p>
  
  <pre><code>$order_display = $$template_to_get['order'];
  $order_display = "$".$template_to_get['order'];
  ...
  </code></pre>
  
  <p>If I write this line it works but I don't know if it's choice1 or choice 2 which will be posted:</p>
  
  <pre><code>$order_display = $choice1['order'];
  </code></pre>
  
  <p>I would like to get the (1,2,3,4,5) array as output.
  (I simplified but I have around 20 choiceX)</p>
  
  <p>Thanks!</p>