title: stripos() expects parameter 1 to be string
body: <p>This question has made me confused for days, I highly appreciate someone can help to sort it out.</p>
  
  <p>I am running wp on apache+Ubuntu 14.04 64.</p>
  
  <p>Someone has written me small php codes to display the coming url and match/display keyword from a text file (saying aaa.txt, not database involved).</p>
  
  <p>The codes are "clever", but with some php errors. But I cannot correct it:</p>
  
  <blockquote>
    <p>Warning: stripos() expects parameter 1 to be string, array given in
    {edited}.php(373) : eval()'d code on line 15</p>
  </blockquote>
  
  <p>It seems <code>if (0 === strpos($host, $suffix)) {</code> is not correct, but I am a newbie, how to change it?</p>
  
  <p>Here are the codes:</p>
  
  <pre><code>define('ROOT', dirname(__FILE__));
  @$cnText = file_get_contents('aaa.txt');
  $cnText = str_replace('?', '', $cnText);
  $cnText = preg_split('/\n|\r\n/', $cnText);
  foreach ($cnText as $text) {
      $pos = strpos($text, ' ');
      $cnText[substr($text, 0, $pos)] = trim(substr($text, $pos));
  }
  $host = strrev(strtolower($_SERVER['HTTP_HOST']));
  $domain = null;
  $domainSuffix = array('.com.cn','.net.cn','.org.cn','.gov.cn','.com','.cn','.net','.cc','.org','.info','.biz','.tv','.guru');
  $keyword = array();
  foreach ($domainSuffix as $suffix) {
      $suffix = strrev($suffix);
  if (0 === strpos($host, $suffix)) {
          $host = explode('.', substr($host, strlen($suffix)));
          $keyword[0] = strrev($host[0]);
          if(0 === strpos($keyword[0], 'xn--')) {
              require_once('idna_convert.class.php');
              $IDN = new idna_convert();
              $keyword[0] = $IDN-&gt;decode($keyword[0]);
          }
          $domain = $keyword[0] . strrev($suffix);
      }
       }
  if (!empty($domain)) {
      $keywords = '';
      if (array_key_exists($domain, $cnText)) {
          $data = explode(' ', $cnText[$domain]);
          foreach($data as $key =&gt; $value) {
              $value = trim($value);
                  $keyword[$key] = $value;
                  $keywords .= " $value";
              }
          }
      }
      echo $keywords;
  ?&gt;
  </code></pre>