note 105041 added to function.array-key-exists
| From: | r.sheari | Date: | Sun, 24 Jul 2011 21:27:12 +0000 |
| Subject: | note 105041 added to function.array-key-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181812@lists.php.net to get a copy of this message | ||
<?php
function arrayKeysExistParameters($method, $keys)
{
if(is_array($keys))
{
$cKeys = count($keys);
$cMethod = count($method);
$i = 0;
if($cKeys == $cMethod)
{
foreach($keys as $key)
if(array_key_exists($key, $method))
$i++;
if($cKeys == $i)
return true;
}
}
return false;
}
// URL: get.php?name=reza&family=sheari
if(arrayKeysExistParameters($_GET, array("name", "family")))
echo "Correct URL";
else
echo "Incorrect URL";
// you can use this function for POST, REQUEST and ...
?>
get.php?name=reza&family=sheari
[Output]:
Correct URL
----
Server IP: 69.147.83.197
Probable Submitter: 46.19.140.114
----
Manual Page -- http://www.php.net/manual/en/function.array-key-exists.php
Edit -- https://master.php.net/note/edit/105041
Del: integrated -- https://master.php.net/note/delete/105041/integrated
Del: useless -- https://master.php.net/note/delete/105041/useless
Del: bad code -- https://master.php.net/note/delete/105041/bad+code
Del: spam -- https://master.php.net/note/delete/105041/spam
Del: non-english -- https://master.php.net/note/delete/105041/non-english
Del: in docs -- https://master.php.net/note/delete/105041/in+docs
Del: other reasons-- https://master.php.net/note/delete/105041
Reject -- https://master.php.net/note/reject/105041
Search -- https://master.php.net/manage/user-notes.php