json_encode($MonArrayPhp)
Documentation offciel : https://www.php.net/manual/fr/function.json-encode.php
exemple :
<?php $MonArrayPhp = array("test","test01","test02","test03"); ?> <script> alert('<?php echo json_encode($MonArrayPhp)?>') ; </script>