How to create a blank associative array in php
<p>My php script returns data to the web client where it is processed by javaScript.</p>

<p>If data is found it is stored in an associative array / object.  If no data is found I would like to send a blank associative array.</p>

<p>The only example I have seen on line is in the manual where you create an empty class and then instantiate an object from that.</p>

<p>Below is my code and the results it produces on the web client side</p>

<pre><code>            $sql = 'select job, client, project from jobs j left join client c on c.key = j.cKey where j.key='.$this-&gt;p['reckey'];
        if ( $result = $db-&gt;query($sql) )
        {
            if ($result-&gt;num_rows &gt; 0)
            {
                $l = mysqli_fetch_all( $result, $resulttype = MYSQLI_ASSOC );
                $this-&gt;res_array['info'] = $l[0];
            }else{
                $this-&gt;errors[] = 'No such job # '.$this-&gt;p['reckey'];
                $this-&gt;res_array['info']=[];
            }
        }else{
            $this-&gt;errors[] = 'Query failed!';
            $this-&gt;res_array['info']=[];
        }
        $this-&gt;res_array['errors'] = $this-&gt;errors;
        echo json_encode ($this-&gt;res_array);
</code></pre>

<p>Here are two examples of what the data looks like when it arrives at the web client before it is decoded by JSON. Note the difference in the "info" element.</p>

<p>response {<strong>"info":{"job":"999","client":"My Company, Inc. ","project":"This Project"}</strong>,"errors":[]}</p>

<p>error response {<strong>"info":[ ]</strong>,"errors":["No such job # 0"]}</p>

<p>In the successful response I have an object/associative array where I would use the </p>

<pre><code>for (variable in object) {...}
</code></pre>

<p>In the blank response I just get the standard array [ ] square brackets where I would use the</p>

<pre><code>for (step = 0; step &lt; info.length; step++) {}
</code></pre>

<p>This occurs of course because I am specifying a blank array in the php code above. </p>

<p>My question is simple how can I change my php code so a blank associtive array is transmitted?</p>