note 77848 deleted from function.array-key-exists by crell
| From: | crell@php.net | Date: | Wed, 29 Jun 2022 20:40:08 +0000 |
| Subject: | note 77848 deleted from function.array-key-exists by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218751@lists.php.net to get a copy of this message | ||
Note Submitter: diogoshaw at gmail dot com
----
this function very good to use if you need to verify many variables:
<?php
function array_key_exists_r($keys, $search_r) {
$keys_r = split('\|',$keys);
foreach($keys_r as $key)
if(!array_key_exists($key,$search_r))
return false;
return true;
}
?>
e.g.
<?php
if(array_key_exists_r('login|user|passwd',$_GET)) {
// login
} else {
// other
}
?>
works for me, enjoy.
dg shaw.