note 88281 modified in function.array-key-exists by danbrown
| From: | danbrown@php.net | Date: | Mon, 19 Jan 2009 16:54:00 +0000 |
| Subject: | note 88281 modified in function.array-key-exists by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149456@lists.php.net to get a copy of this message | ||
Here is a little function for case sensitivity to elaborate on what was said by MarkL from ##php
(Freenode) and mmanning at mdanderson dot org from this page:
<?php
// Case sensitive version of array_key_exists() using preg_match()
function array_ikey_exists($key,$arr)
{
if(preg_match("/".$key."/i", join(",", array_keys($arr))))
return true;
else
return false;
}
?>
Not that anyone else couldn't have written this, but a concept like this strengthens
reusability. :)
--was--
Here is a little function for case sensitivity to elaborate on what was said by MarkL from ##php
(Freenode) and mmanning at mdanderson dot org from this page:
// Case sensitive version of array_key_exists() using preg_match()
function array_ikey_exists($key,$arr)
{
if(preg_match("/".$key."/i", join(",", array_keys($arr))))
return true;
else
return false;
}
Not that anyone else couldn't have written this, but a concept like this strengthens
reusability. :)
http://php.net/manual/en/function.array-key-exists.php