json_encode function will returns a string containing the JSON representation of a value.it supports only UTF-8 encoded
See the Example here
1 2 3 4 5 |
<?php $arr = array('v1' => 1, 'v2' => 2, 'v3' => 3, 'v4' => 4, 'v5' => 5); echo json_encode($arr); ?> |
Output:
——-
{“v1″:1,”v2″:2,”v3″:3,”v4″:4,”v5”:5}