Re: Comparing string to array
| From: | Stut | Date: | Tue, 19 Jun 2007 13:21:40 +0000 |
| Subject: | Re: Comparing string to array | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-257401@lists.php.net to get a copy of this message | ||
Richard Davey wrote:
Hi Stut, Tuesday, June 19, 2007, 1:49:53 PM, you wrote:Not quite what I was thinking of. More like this: http://dev.stut.net/php/davey2.php -Stut -- http://stut.net/Very nice, thank you. I was hoping there would be a way to do it without resorting to eval(), but if even you can't figure out how, I'm not going to waste any more time trying to either :)You probably could by breaking it into each part and then using a loop to descend to the right place, but I don't think that's going to be any better than using eval.I was wondering about doing something like this: Recurse through $_POST, grabbing all of the keys, and then building a string from them, something like: icecream_batch2_flavours and then storing the value of 'flavours' in a new array with the above as the key. Then I could manipulate the form input name: name="icecream[batch2][flavours][]" or name="icecream['batch2']['flavours'][]" To resemble the above key relatively simply.