title: php Deprecated: Function eregi() is deprecated in, how to?
body: <p>i have this function, and i get this error <code>Deprecated: Function eregi() is deprecated in...</code>. If i change <code>eregi</code> to <code>preg_match</code> i get this error <code>Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in...</code></p>
  
  <pre><code>function getBrowser($userAgent) {
  $browsers = array(
      'Opera' =&gt; 'Opera',
      'Mozilla Firefox'=&gt; '(Firebird)|(Firefox)', // Use regular expressions as value to identify browser
      'Galeon' =&gt; 'Galeon',
      'Chrome'=&gt;'Gecko',
      'MyIE'=&gt;'MyIE',
      'Lynx' =&gt; 'Lynx',
      'Netscape' =&gt; '(Mozilla/4\.75)|(Netscape6)|(Mozilla/4\.08)|(Mozilla/4\.5)|(Mozilla/4\.6)|(Mozilla/4\.79)',
      'Konqueror'=&gt;'Konqueror',
      'SearchBot' =&gt; '(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)|(msnbot)|(ia_archiver)',
      'Internet Explorer 8' =&gt; '(MSIE 8\.[0-9]+)',
      'Internet Explorer 7' =&gt; '(MSIE 7\.[0-9]+)',
      'Internet Explorer 6' =&gt; '(MSIE 6\.[0-9]+)',
      'Internet Explorer 5' =&gt; '(MSIE 5\.[0-9]+)',
      'Internet Explorer 4' =&gt; '(MSIE 4\.[0-9]+)',
  );
  foreach($browsers as $browser=&gt;$pattern) {
      if(eregi($pattern, $userAgent)) {
          return $browser; 
      }
  }
  return 'Unknown'; 
  }
  </code></pre>
  
  <p>any ideas on how to fix this. and also i would like a dumbed down explanation on what is happening if you guys dont mind so i can understand</p>
  
  <p>thanks</p>