Possible Duplicate:
Generating a JavaScript array from a PHP array
I just want to know how to create JavaScript array with the help of PHP and help are definitely appreciated
I have a PHP result to this form
Array
(
[0] => stdClass Object
(
[id] => 11
[name] => MLB
[totalcount] => 4
)
[1] => stdClass Object
(
[id] => 35
[name] => American Idol
[totalcount] => 2
)
)
and i want to convert this array to JavaScript array like this
<script type="text/javascript">
var myData = new Array(['MLB', 4], ['American Idol', 2]);
</script>