jacko310592 Posted February 21, 2010 Share Posted February 21, 2010 hey guys, at the moment, i have a code for my site which uses $_SERVER['HTTP_USER_AGENT'] to find the users OS, which goes as follows foreach($OSList as $CurrOS=>$Match) { if (eregi($Match, $_SERVER['HTTP_USER_AGENT'])) { break; } } $OSLis is an array with various OS's, each OS in the array is set out like this: 'Windows XP' => '(Windows NT 5.1)|(Windows NT 5.2)|(Windows XP)', as you can see, to make the match, i am using eregi, but as this function is going to be removed as of php 6 i was wondering if anyone suggest an alternative to do the same as what i have at the moment. thanks guys Link to comment https://forums.phpfreaks.com/topic/192827-eregi-alternative/ Share on other sites More sharing options...
jskywalker Posted February 21, 2010 Share Posted February 21, 2010 on the same manual page where is says that eregi is deprecated is says: Note: As of PHP 5.3.0, the regex extension is deprecated in favor of the PCRE extension. Calling this function will issue an E_DEPRECATED notice. The PCRE-extension is documented on: http://nl2.php.net/manual/en/book.pcre.php so, with version 6.0 you will have to use preg_grep or preg_match or preg_match_all, which (of course) work slightly different from eregi.... Link to comment https://forums.phpfreaks.com/topic/192827-eregi-alternative/#findComment-1015721 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.