I need to convert tempArr, an associative array, to JSON and write it in a file.
I am using the following code, but I get a json_encode(): recursion detected warning.
$tempArr = array('one' => $var1, 'two'=> $var2, 'three'=>$var3);
$fp = fopen('myFile.json', 'w');
fwrite($fp, json_encode($tempArr));
fclose($fp);
What am I doing wrong?