Convert php array to js array

by Prabakaran 2012-09-07 17:36:50

<script type='text/javascript'>
<?php
$php_array = array('abc','def','ghi');
$js_array = json_encode($php_array);
echo "var javascript_array = ". $js_array . ";\n";
?>
</script>
848
like
0
dislike
0
mail
flag

You must LOGIN to add comments