php string to javascript array code example
Example 1: set array in javascript from php
//set array in javascript from php array
var jsarry = <?php echo '["' . implode('", "', $phparry) . '"]' ?>;
Example 2: php array to js
var arrNums = json_encode(<?php echo $arrNums; ?>);
Example 3: copy php array to javascript
var js_array = [<?php echo '"'.implode('","', $php_array).'"' ?>];