I am trying to place the json_encoded variable on to a file using file_put_contents. I do not know why its returning a null value on the destination file.
$json1=json_encode($php);
file_put_contents("path/text.txt",$json1);
I am trying to place the json_encoded variable on to a file using file_put_contents. I do not know why its returning a null value on the destination file.
$json1=json_encode($php);
file_put_contents("path/text.txt",$json1);
json_encode() will set a null value in elements that contain an invalid (non-UTF-8) character.
Make sure your incoming data doesn't contain invalid characters. If it's coming from a different encoding, use iconv() to convert it to UTF-8 first.