I find the quickest and easiest way to work with a PHP array in Javascript is to do this:
PHP:
$php_arr = array('a','b','c','d');
Javascript:
//this gives me a JSON object
js_arr = '<?php echo JSON_encode($php_arr);?>';
//Depending on what I use it for I sometimes parse the json so I can work with a straight forward array:
js_arr = JSON.parse('<?php echo JSON_encode($php_arr);?>');