It looks like you're new here. If you want to get involved, click one of these buttons!Sign In Register
It looks like you're new here. If you want to get involved, click one of these buttons!
The json_encode function is tailor-made for passing arrays; it can be used to pass single-level arrays and multidimensional arrays as well.
Using PHP's implode Function
var ar = <?php echo '["' . implode('", "', $ar) . '"]' ?>;
Here we demonstrate with a numerically indexed array: