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

From: Date: Mon, 25 Jul 2011 12:26:20 +0000
Subject: note 105041 deleted from function.array-key-exists by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-181827@lists.php.net to get a copy of this message
Note Submitter: r.sheari [at] gmail [dot] com ---- <?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

« previous php.notes (#181827) next »