PHP JSON Returned As Object Instead of Array

I was returning, what I thought was an array from PHP, but it kept returning it as a json object, so I had something like:


$listItem[0][0] = "Jan 1";
$listItem[0][1] = 100;


$listItem[1][0] = "Jan 2";
$listItem[1][1] = 120;


$listItem[2][0] = "Jan 2";
$listItem[2][1] = 120;




This would return in javascript those an array, but the index for each set was actually an object.  What was going on was apparently my ordered sequence (0,1,2,...) was actually missing a number in there somehow, and that was turning it into an object instead of an array.  Apparently the array values need to start with 0 and can't skip any numbers for it to be returned as a numerical array.




Related Posts

Importing Large MySQL Files into PHPMyAdmin

The default file size for uploading mysql dump files into PHPmyadmin is around 2mb. I needed to upload a 160mb file...
Read Post

Simple Sticky Element

The user scrolls down the page and once the scrolling reaches the top of an element of my choosing, that element sticks to the top of the window, so it's always visible from that point on...
Read Post

Removing the Horizontal Margins on a Google Chart Graph

I seem to be able to successfully modify quite a bit with google charts, but I couldn't find a good way to remove the horizontal padding to the left and right of a google graph. From what I can find, there really isn't a good way to do it...
Read Post

A Simple Slideout Menu

I just wanted an easy slideout menu. Click on a link, and the menu slides out from the left side of the screen. Click on the link again, or somewhere else on the page, and the menu slides back in...
Read Post