title: Why array_diff() gives Array to string conversion error?
body: <p>I get array to string conversion error for the following line:</p>
  
  <pre><code>$diff = array_diff($stockist, $arr);
  </code></pre>
  
  <p>Here, <code>$arr</code> is an array decoded from a JSON file. Using the <code>is_array()</code> function I was able to verify that both parameters are arrays. Can someone point me the problem</p>
  
  <pre><code>$stockist = array();
  while (!feof($file_handle)) {
  
      $line_of_text = fgetcsv($file_handle);
      $query = "SELECT * FROM reorderchart WHERE medicine = '"
          . trim($line_of_text[3])
          . "' ORDER BY medicine";
      $result = mysql_query($query);
  
      if (trim($line_of_text[2]) - trim($line_of_text[1]) &lt;= 0) {
  
          while ($row = mysql_fetch_array($result)) {
  
              $file = "results.json";
              $arr = json_decode(file_get_contents($file),true);
              $pharmacy = trim($row['Medicine']);
  
              if (isset($stockist[$pharmacy])) {
  
                  $medicine = $stockist[$pharmacy];
                  $medicine[] = trim($row['Stockist']);
                  $stockist[$pharmacy] = $medicine;
  
              } else {
  
                  $medicine = array();
                  $medicine[] = trim($row['Stockist']);
                  $stockist[$pharmacy] = $medicine;
              }
          }
      }
  }
  $diff = array();
  $diff = array_diff_assoc($stockist,$arr);
  ksort($diff);
  foreach ($diff as $key =&gt; $value) {
  
      echo "&lt;table align='center' border='1'&gt;";
      echo "&lt;tr&gt;&lt;td align = 'center'&gt; &lt;font color = 'blue'&gt; $key&lt;/td&gt;&lt;/tr&gt;";
  
      foreach($value as $key1 =&gt; $value1) {
  
          echo "&lt;tr&gt;&lt;td align ='center'&gt;$value1&lt;/td&gt;&lt;/tr&gt;&lt;br&gt;";
      }
      echo "&lt;/table&gt;";
  }
  </code></pre>