Re: Re[2]: [PHP] Comparing string to array
| From: | Robin Vickery | Date: | Wed, 20 Jun 2007 15:53:32 +0000 |
| Subject: | Re: Re[2]: [PHP] Comparing string to array | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-257503@lists.php.net to get a copy of this message | ||
On 19/06/07, Richard Davey <rich@corephp.co.uk> wrote:
Hi Robin, Tuesday, June 19, 2007, 8:28:50 PM, you wrote: On 19/06/07, Richard Davey <rich@corephp.co.uk> wrote:This should of course have a 'return' before the 'false'. I should really test things before I post. -robinfull_key_exists("test['sam'][]", $_POST) // returns true if key is set full_find_key("test['sam'][]", $_POST) // returns value of key or undef. function full_key_exists ($key, $array) { preg_match_all('/[^][]+/', $key, $branch); if (!sizeof($branch[0])) false;$userparam = "test['sam'][]";// How to check if $userparam exists in the $_POST array // and get all the values from it?