Fabrizio Bartolomucci Fabrizio Bartolomucci - 1 year ago 90
JSON Question

JsonEncode returns empty string in php

I am trying to encode an Array into Json. I tried with a complex one and the result was empty. So I tried with a very simple array and the result was the same:

$result=Array("pippo", "pluto");

The print_r correctly prints the array, but json_encode returns nothing.
What may be the problem?

Answer Source

Please try below

    $result=Array("pippo", "pluto");
    echo json_encode($result);

Or Refer URL https://eval.in/631616