rayman0487 Posted January 9, 2013 Share Posted January 9, 2013 Hi all, I'm working on creating a simple API for an application re-write, however I'm having a difficult time trying to accomplish request verification - in a simple way. Here is what I have so far.... $AvailableRequest = array( array ('Request1'), array ('Request2'), array ('Request3', 'req' => array('parm1', 'parm2'), 'opt' => array('parm3')), array ('Request4', 'opt' => array('parm1')), array ('Request5', 'req' => array('parm1'), 'opt' => array('parm2')) ); I use this array to store all the allowable request and they required (req) and optional (opt) parameters that can/must be submitted too. What I currently do is use a function that loops through the array using the submitted requested and makes sure that the request in valid. What I'd like to do next is make sure that all the keys in the req array were also submitted. For example. api.php?request=Request5&parm1=Foo - This should work api.php?request=Request5 - This should return an error response Is there a simple way to accomplish this that I'm overlooking? Thanks for all the help. Quote Link to comment https://forums.phpfreaks.com/topic/272897-multidimensional-array-validation/ Share on other sites More sharing options...
Jessica Posted January 9, 2013 Share Posted January 9, 2013 You have the array, now loop through it and use isset(). Quote Link to comment https://forums.phpfreaks.com/topic/272897-multidimensional-array-validation/#findComment-1404460 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.