<?php
// php array
$fruits = array('apple', 'orange', 'mango', 'banana', 'strawberry');
?>
<script type="text/javascript">
// use php implode function to build string for JavaScript array literal
var fruits = <?php echo '["' . implode('", "', $fruits) . '"]' ?>;
// ["apple", "orange", "mango", "banana", "strawberry"]
</script>