title: json_decode returning an array of 1
body: <p>I am trying to decode some JSON into a php array. Here's the code excerpt: </p>
  
  <pre><code>$getfile="{"fname":"bob","lname":"thomas","cascade":"bthomas","loc":"res","place":"home 2"}";
  $arr = json_decode($getfile, true);
  $arr['day3'] = $selecter;
  echo(print_r($arr));
  </code></pre>
  
  <p>The only thing that gets returned is '1'. I've checked JSONLint and it is valid json, so I'm wondering why json_decode is failing. I also tried checking what the array is before adding the day3 key to it, and I still return a '1'. Any help is appreciated!</p>
  
  <p>Actual code:</p>
  
  <pre><code>$getfile = "";
      $getfile = file_get_contents($file);
      if ($getfile == "") {
          writeLog("Error reading file.");
      }
      writeLog("getfile is " . $getfile);
      writeLog("Decoding JSON data");
      $arr = json_decode($getfile, true);
      writeLog("Decoded raw: " . print_r($arr));
      writeLog("Editing raw data. Adding data for day " . $day);
      $arr['day3'] = $selecter;
      writeLog(print_r($arr));
      $newfile = json_enconde($arr);
      writeLog($newfile);
      if (file_put_contents($file, $newfile)) {
          writeLog("Wrote file to " . $file);
          echo $newfile;
      } else {
          writeLog("Error writting file");
      }
  </code></pre>
  
  <p>These are the contents of $file (it's a text file)</p>
  
  <pre><code>{"fname":"Bob","lname":"Thomas","cascade":"bthomas","loc":"res","place":"home 2"}
  </code></pre>