> From: Paul Halliday [paul.halliday@xxxxxxxxx] > Sent: 24 October 2012 18:38 > To: PHP-General > Subject: Array help. > > $groupMappings = array('40' =>'A','41' =>'B','1' =>'C'); > > $ocTest = explode(".", $ip); > $groupKeys = array_keys($groupMappings); > $groupTest = array_search("$ocTest[2]", $groupKeys); > > if($groupTest != FALSE) { I think you're making a little bit of a meal of this. My initial thoughts included pointing you at array_key_exists() (and, why on earth have you got $ocTest[2] in quotes?), but then I realised if I were writing this I'd probably just use isset(), thus: $ocTest = explode(".", $ip); if (isset($groupMappings[$ocTest[2]])): // success else: // fail endif; Hope this helps! Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Information Portland PD507, City Campus, Leeds Metropolitan University, Portland Way, LEEDS, LS1 3HE, United Kingdom E: m.ford@xxxxxxxxxxxxxx T: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php