I have an associative array tempArr
which I need to convert to JSON and write into a json file:
$tempArr = array('one' => $var1, 'two'=> $var2, 'three'=>$var3);
$fp = fopen('myFile.json', 'w');
fwrite($fp, json_encode($tempArr));
fclose($fp);
But this code shows a warning where it says that json_encode(): recursion detected. What am I doing wrong?