Variable global variable?
-
29-10-2019 - |
Question
I'm trying to automatically sanitize input on an array of global variables like so:
$sanitize = array('_POST', '_GET', '_REQUEST', '_COOKIE', '_SESSION');
foreach($sanitize as $type){
$property = trim(strtolower($type), '_');
$this->$property = $this->cleanse($$type);
}
But I get: Notice: Undefined variable: _REQUEST
(and so on for all of the global variables I'm trying)
Is doing what I'm trying to accomplish actually possible?
Thanks.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow