1<script type="text/javascript">
2var phpVars = {
3<?php
4 foreach ($phpToJsVars as $key => $value) {
5 echo ' ' . $key . ': ' . '"' . $value . '",' . "\n";
6 }
7?>
8};
9</script>
10
1<script type="text/javascript" src="YourFunctions.js"></script>
2<script type="text/javascript">
3 functionOne(<?php echo implode(', ', $arrayWithVars); ?>);
4 functionTwo(<?php echo $moreVars; ?>, <?php echo $evenMoreVars; ?>);
5</script>
6
1AddType application/x-httpd-php .js
2
3AddHandler x-httpd-php5 .js
4
5<FilesMatch "\.(js|php)$">
6SetHandler application/x-httpd-php
7</FilesMatch>
8