Empty substring, what's wrong here?
<p>Warning: substr_count() [function.substr-count]: Empty substring.</p>

<p>I get this message when calling the function browsertest. Here is the part of the function, it tells me that here is something wrong</p>

<pre><code>if(substr_count($referer, $tld[$i]) &gt; 0)
</code></pre>

<p>the function is displayed beneath. Thank you for your time and interest in my problem.</p>

<pre><code>function testbrowser()
{
    //check for browser type
    $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);

    //set safe browser types
    $browser[0] = "msie 6";
    $browser[1] = "msie 7";
    $browser[2] = "firefox";
    $browser[3] = "safari";

    $i = 0;
    $user_agent_ok = 0;
    while($i &lt; 4)
    {
        if(strpos($useragent, $browser[$i]) &gt; 0)
        {
            $user_agent_ok = 1;
            $i=4;
        }
        $i++;
    }

    if ($user_agent_ok == 1)
    {
        //check referer
        $safe = 0;
        $query  = "SELECT * FROM safe_referers";
        $result = mysql_query($query);

        //check for blank referer
        if ($_SERVER['HTTP_REFERER'] != ""  AND (substr_count($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME']) == 0))
        {
            //strip down referer information to http://subdomain.domain.tld
            $tld[0] = ".com";
            $tld[1] = ".net";
            $tld[2] = ".org";
            $tld[3] = ".info";
            $tld[4] = ".co.uk";
            $tld[5] = ".co.in";
            $tld[6] = ".it";
            $tld[8] = ".gr";
            $tld[9] = ".no";
            $tld[10] = ".de";
            $tld[11] = ".ru";
            $tld[12] = ".pl";
            $tld[13] = ".dk";
            $tld[14] = ".pt";
            $tld[15] = ".ca";

            $i = 0;
            while($i &lt; 16)
            {
                $referer = strstr ($_SERVER['HTTP_REFERER'], "http://");
                if(substr_count($referer, $tld[$i]) &gt; 0)
                {
                    $referer = substr($referer, 0, strpos($referer, $tld[$i]));
                    $referer = $referer . $tld[$i];
                    $i=16;
                }
                $i++;
            }
</code></pre>
