note 88290 deleted from function.array-key-exists by danbrown

From: Date: Mon, 19 Jan 2009 16:58:20 +0000
Subject: note 88290 deleted from function.array-key-exists by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-149462@lists.php.net to get a copy of this message
Note Submitter: John ---- I've been running into issues with escaping for Regex, so I decided to give something like this a shot: <?php function array_ikey_exists($key,$arr) { $e = 0; //$key = addslashes($key); if(is_array($arr) && $arr !==array()) { foreach($arr as $k => $v) { if(strtolower($k) == strtolower($key)) $e++; } if($e>0) return true; else return false; } else return false; } ?> You could addslashes() to escape; it's just another approach. Comments & improvements are welcome.

« previous php.notes (#149462) next »