title: php cast JSON array keys to integer
body: <p>I need array keys in json array to be integers. Now they are strings. Could you tell me where is my mistake?</p>
  
  <pre><code>   $i = 0;
     while($i &lt; 7) {
         isset($ips[date('d', $week_start + $i * 86400)])
             ? $ips[(int)date('d', $week_start + $i * 86400)] = count(date('d', $week_start + $i * 86400))
             : $ips[(int)date('d', $week_start + $i * 86400)] = 0;
  
         isset($time[date('d', $week_start + $i * 86400)])
             ? $time[(int)date('d', $week_start + $i * 86400)] = count(date('d', $week_start + $i * 86400))
             : $time[(int)date('d', $week_start + $i * 86400)] = 0;
  
         $i++;
     }
  
     return json_encode(array('unique' =&gt; $time, 'impressions' =&gt; $ips));
  </code></pre>