title: Using dispatch tables in PHP
body: <p>I have this chunk of code, one sample is <code>$dispatch='TC_12'</code>:</p>
  
  <pre><code>foreach($this-&gt;dispatch as $dispatch){
     $data['$dispatch'] = $this-&gt;genericQuery($dispatch, '1');
  }
  </code></pre>
  
  <p><code>$this-&gt;dispatch</code> is an array of <strong>dispatch tables</strong>. However, I wrote the method <code>genericQuery()</code> to generate dynamically generated queries. Everything works fine, except when I analyse the <code>JSON</code> object returned I saw:</p>
  
  <pre><code>`"$dispatch":["Hello world"]}`
  </code></pre>
  
  <p>However I would like to see <code>"TC_12":["Hello world"]</code>.
  How can I obtain that result? I thought the string would get replaced at <code>$data['$dispatch']</code>.</p>