I'm trying to return an array in HTTP response. I'm thinking to return array as JSON objects. I'm doing echo json_encode($arr) but I get nothing in the response.
UPDATE: I'm running a version of PHP that does not have json_encode method. json_encode was introduced in PHP 5.2. So I guess question is how would you return an array without using json_encode?
$arr = array();
foreach($_POST['ids'] as $id)
{
$arr[$id] = $id;
}
echo json_encode($arr);
return;
Here are contents of my array:
array(18) {
[156795]=>
string(6) "156795"
[156800]=>
string(6) "156800"
[4292]=>
string(4) "4292"
[796053]=>
string(6) "796053"
[660520]=>
string(6) "660520"
...