I have a php array of objects istantiated from the following class:
class my_class {
public $id;
public $timestamp;
}
These are stored in an array with indexes 0,1,2.....
I am getting this array with jquery through the Session variable and I attempt to print it in the following ways:
var myclass_map = "<?php $_SESSION['myclass_map']?>";
$.each(myclass_map, function(key, value) {
console.log(key + ' ' + value["id"]);
});
and
var track_map = "<?php $_SESSION['myclass_map']?>";
$.each(myclass_map, function(key, value) {
console.log(key + ' ' + value.id);
});
but both give me an undefined reference to value while the print out the key. How can I access the objects variables?