if (preg_match('Win95',$ua)) { 
            $browser['platform'] = "Windows 95"; 
            }  

Warning: preg_match(): Delimiter must not be alphanumeric or backslash in
in /homepages/33/d183561635/htdocs/xtc.../includes/pt_counter_stats.php on line 43

What is to do?

    You should read the PHP manual concerning [man]PCRE[/man]. Anyway, the problem is that your regex pattern does not have the appropriate delimiters, e.g., '/Win95/' instead of just 'Win95'. That said, if you are just trying to compare strings for equality then regex is overkill. Just use:

    if ($ua === 'Win95') {

      Or if you need to find that string within a larger string:

      if(strpos($ua, 'Win95') !== false) // important to use "!==", not just "!="
      {
          // it's Win95
      }
      

      And you can change it to stripos() if you want it to be case-insensitive.

        @
        Thanks, no more warning on line 43

        perhaps you can help also here:

        		else if (eregi('BSD',$ua) || eregi('FreeBSD',$ua) || eregi('NetBSD',$ua)) {
        		     $browser['platform'] = "BSD";

        Deprecated: Function eregi() is deprecated in /homepages/33/d183561635/htdocs/xtc.../includes/pt_counter_stats.php on line 76

        Deprecated: Function eregi() is deprecated in /homepages/33/d183561635/htdocs/xtc.../includes/pt_counter_stats.php on line 76

        Deprecated: Function eregi() is deprecated in /homepages/33/d183561635/htdocs/xtc.../includes/pt_counter_stats.php on line 76

          laserlight;11045433 wrote:

          You should read the PHP manual concerning [man]PCRE[/man]. Anyway, the problem is that your regex pattern does not have the appropriate delimiters, e.g., '/Win95/' instead of just 'Win95'. That said, if you are just trying to compare strings for equality then regex is overkill. Just use:

          if ($ua === 'Win95') {

          That is great. Thank you :-)

            toppi24;11045443 wrote:

            perhaps you can help also here:

            Deprecated: Function eregi() is deprecated in /homepages/33/d183561635/htdocs/xtc.../includes/pt_counter_stats.php on line 76

            Deprecated: Function eregi() is deprecated in /homepages/33/d183561635/htdocs/xtc.../includes/pt_counter_stats.php on line 76

            Deprecated: Function eregi() is deprecated in /homepages/33/d183561635/htdocs/xtc.../includes/pt_counter_stats.php on line 76

            As the message states, the function is deprecated, meaning it is old and no longer supported, and that there is a better function. To my knowledge all the ereg functions are deprecated in favour of preg functions.

            Also as NogDog suggested, if you're simply looking for a string within another string, you can use strpos() or stripos() for case-insensitivity:

            else if (stripos($ua, 'BSD') !== false) // important to use "!==", not just "!="
            {
                //It's BSD
            }
            
              Write a Reply...