When I print_r($arr)
something like Array ( [0] => Hello [1] => world);
is output.
I tried to convert in JSON string using below code.
$result['result'] = $arr;
json_encode($result);
This results in this JSON string:
{"result" : { "0" : "hello" , "1" : "world"}}
The expected result would be this:
{ "result" : ["hello" , "world"]}
What can I do to get the desired output?