laPistola Posted January 1, 2009 Share Posted January 1, 2009 Right i making an info panel for a website that returns useful information to the client for when they are speaking to PC teckys on the phone and one of the bits of info is there ISP As gethostbyaddr($_SERVER['REMOTE_ADDR']) returns a horrbile long string of text the user wouldn't really understand and telling the tecky each letter of the string will take time i thought it would benfit if it just said the ISP name, so i have asked longs of people to send me the results of gethostbyaddr($_SERVER['REMOTE_ADDR']) on there computer and which ISP there with. Anyway, all im after is the correct function to use to do a basic search on a string, i have looked at preg_match() and strstr() but dont think they are the correct ones to use. this is what the script will be like <?php $host = gethostbyaddr($_SERVER['REMOTE_ADDR']); if (search here for ntl) { echo 'Virgin Media (NTL)'; } else if (search of sky) { echo 'Sky'; } else if (search for bt) { echo 'BT'; } and so on ?> does anyone know of the fastest simplest function to do that kinda search Thank you Link to comment https://forums.phpfreaks.com/topic/139089-search-string/ Share on other sites More sharing options...
laPistola Posted January 3, 2009 Author Share Posted January 3, 2009 so i take it strstr() is the fastest and simplest way then?? Link to comment https://forums.phpfreaks.com/topic/139089-search-string/#findComment-728702 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.