Hello everybody. I have the following class method:
function HTTPValidator($method) { $this->data = ${'_'.$method}; $this->rules = array(); $this->required = array(); } data, rules and required are arrays. The parameter $method can have the values: GET or POST. I'm trying to store the superglobal array in the data class property. To get the superglobal array ($_GET or $_POST), I try to build these strings '_'.$method. I'm sure this part works, PHP builds the string _GET or _POST according to the $method parameter. I use ${'_'.$method} to get the contents of the superglobal. But this piece of code doesn't work. It seems like PHP doesn't build the $_GET or $_POST string. Funny thing, I tried the same code on another script and worked. Here's that script: <?php echo '<pre>'; print_r($_POST); echo '</pre><br><br>'; $method = 'POST'; $data = ${'_'.$method}; echo '<pre>'; print_r($data); echo '</pre><br><br>'; ?> (I even tried to send the $method parameter as '_GET' and '_POST', and didn't work either). I'm very confused. Thanks for any help. __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php