Jump to content


Photo

Deprecated: Function eregi() is deprecated (Line 18)


  • Please log in to reply
4 replies to this topic

#1 TottoBennington

TottoBennington

    Member

  • Members
  • PipPip
  • 16 posts

Posted 31 July 2012 - 04:31 PM

Can anyone help me with this error ?
Deprecated: Function eregi() is deprecated in C:\wamp\www\phpDetectIE\index.php on line 18

<?php 
function ObtenerNavegador($user_agent) {
     $navegadores = array(
          'Opera' => 'Opera',
          'Mozilla Firefox'=> '(Firebird)|(Firefox)',
          'Galeon' => 'Galeon',
          'Mozilla'=>'Gecko',
          'MyIE'=>'MyIE',
          'Lynx' => 'Lynx',
          'Netscape' => '(Mozilla/4\.75)|(Netscape6)|(Mozilla/4\.08)|(Mozilla/4\.5)|(Mozilla/4\.6)|(Mozilla/4\.79)',
          'Konqueror'=>'Konqueror',
          'Internet Explorer 7' => '(MSIE 7\.[0-9]+)',
          'Internet Explorer 6' => '(MSIE 6\.[0-9]+)',
          'Internet Explorer 5' => '(MSIE 5\.[0-9]+)',
          'Internet Explorer 4' => '(MSIE 4\.[0-9]+)',
);
foreach($navegadores as $navegador=>$pattern){
       if (eregi($pattern, $user_agent))
       return $navegador;
    }
return 'Desconocido';
}
?>
<?php echo ObtenerNavegador($_SERVER['HTTP_USER_AGENT']) ?>


#2 cpd

cpd

    ¬_¬

  • Members
  • PipPipPip
  • 881 posts
  • LocationLondon, UK

Posted 31 July 2012 - 04:37 PM

Its deprecated in the version of PHP your using... so you can't use it. Use preg_match instead.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."

"One of my most productive days was throwing away 1000 lines of code."

#3 .josh

.josh

    .josh

  • Administrators
  • 14,808 posts

Posted 31 July 2012 - 08:42 PM

Its deprecated in the version of PHP your using... so you can't use it. Use preg_match instead.


deprecated doesn't mean you can't use it, it means it's advisable that you stop using it because it will eventually go away and not be supported in future versions of php. 



Did I help you? Feeling generous? Donate to me! || Donate to phpfreaks!
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#4 premiso

premiso

    Trollololol

  • Members
  • PipPipPip
  • 6,969 posts
  • LocationHairy Beaverville

Posted 31 July 2012 - 09:10 PM

if (preg_match("#{$pattern}#i", $user_agent))

Will fix your problem.
Did I assist you? Feeling like contributing to my gaming addiction?

Assist with my gaming addiction! | Free Flash Games | lxt Article Site

#5 cpd

cpd

    ¬_¬

  • Members
  • PipPipPip
  • 881 posts
  • LocationLondon, UK

Posted 01 August 2012 - 05:33 AM


Its deprecated in the version of PHP your using... so you can't use it. Use preg_match instead.


deprecated doesn't mean you can't use it, it means it's advisable that you stop using it because it will eventually go away and not be supported in future versions of php.


Yes sorry, poor choice of wording.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."

"One of my most productive days was throwing away 1000 lines of code."




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com