title: Define dynamic JSON-Array
body: <p>i've got a new problem. </p>
  
  <p>I know how i have to define a static JSON-Array, but now i must make this dynamic so i could add items with a loop.</p>
  
  <p>this is the static version:</p>
  
  <pre><code>$json = array(array('field' =&gt; 'name', 
                      'value' =&gt; $name), 
            array('field' =&gt; 'nummer', 
                      'value' =&gt; $numbers));
  
  echo json_encode($json );
  </code></pre>
  
  <p>and now i got this, but it doesn't work this way:</p>
  
  <pre><code>$element_array = array($element_array);
  array_push($element_array, 'field' =&gt; 'name', 'value' =&gt; $name);
  array_push($element_array, 'field' =&gt; 'nummer', 'value' =&gt; $numbers);
  
  $json = $element_array;
  </code></pre>
  
  <p>any idea what's the problem?</p>