convert php array to json array

by Prakash 2013-10-16 17:05:48

convert php array to json array :

<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>

Tagged in:

613
like
0
dislike
0
mail
flag

You must LOGIN to add comments