Access a php array of indexed objects with jquery
<p>I have a php array of objects istantiated from the following class:</p>

<pre><code>class my_class {
    public $id;
    public $timestamp;
}
</code></pre>

<p>These are stored in an array with indexes 0,1,2.....</p>

<p>I am getting this array with jquery through the Session variable and I attempt to print it in the following ways:</p>

<pre><code>var myclass_map = "&lt;?php $_SESSION['myclass_map']?&gt;";
$.each(myclass_map, function(key, value) {
    console.log(key + ' ' + value["id"]);
});
</code></pre>

<p>and </p>

<pre><code>var track_map = "&lt;?php $_SESSION['myclass_map']?&gt;";
$.each(myclass_map, function(key, value) {
    console.log(key + ' ' + value.id);
});
</code></pre>

<p>but both give me an undefined reference to value while the print out the key. How can I access the objects variables?</p>
