How add elements (key =>value) to an empty array?
<p>How add elements (key =>value) to an empty array with a loop? To build Json data for AJAX response.
I've tried array_push. But not works</p>

<pre><code>$arr = array();
foreach ($result as $row) { 
   array_push($arr, $row-&gt;key =&gt; $row-&gt;value);                          
}   
$data['message'] = json_encode($arr);
</code></pre>
