title: PHP Log file not write json
body: <p>I have a problem.</p>
  <p>my class.log.php</p>
  <pre><code>&lt;?php
   
  date_default_timezone_set('Europe/Istanbul');
   
  class Log
  {
      public function add($uID, $pID, $text)
      {
          $date = date(&quot;d.m.Y&quot;) . &quot; &quot; . date(&quot;H:i:s&quot;);
          $data = array(&quot;Date&quot; =&gt; $date, &quot;UserID&quot; =&gt; $uID, &quot;ProductID&quot; =&gt; $pID, &quot;Text&quot; =&gt; $text);
          
          $folder = &quot;../log/&quot;;
          $logFileName = $folder . date(&quot;d-m-Y&quot;) . &quot;.log&quot;;
   
          if (!file_exists($folder)) {
              mkdir($folder);
          }
   
          if (!file_exists($logFileName)) {
              file_put_contents($logFileName, &quot;\xEF\xBB\xBF&quot;);
          }
   
          $ofile = fopen($logFileName, &quot;a&quot;);
   
          fwrite($ofile, $data);
          fclose($ofile);
      }
  }
  ?&gt;
  </code></pre>
  <p>I use it function like here in pages.</p>
  <pre><code>require_once &quot;class.log.php&quot;;
  $log = new Log();
  $log-&gt;add('41','16','Product Added');
  </code></pre>
  <p>why can't I print output in json format to my .log file.
  I can't find where is the error in the codes</p>