designventures
New Member
I'm now implement such a task:I need to convert PHP variables to javascript\[code\]$arr['name1'] = 'value1';$arr['name2'] = 'value2';\[/code\]so that after processing,should be:\[code\]<script type="text/javascript">var name1 = 'value1';var name2 = 'value2';...\[/code\]I hoped to do it this way:\[code\]<script>list(<?php echo join(',',array_keys($arr)?>) = <?php echo json_encode(array_values($arr));?>\[/code\]