Reputation: 9047
is there a way I could delete/destroy/remove all http request like get, post, file requests after I store them unto the array, e.g.
$input_arr = [];
foreach( $_GET as $i => $v){
$input_arr[$i] = $v;
}
same to post requests
$input_arr = [];
foreach( $_POST as $i => $v){
$input_arr[$i] = $v;
}
and etc. then after stored, destroy/delete/remove all current http requests so they won't be accessible unto my app because simply those requests does not exist anymore. Any help, ideas?
Upvotes: 0
Views: 28
Reputation: 4375
You could simply try unset
ing $_GET
and $_POST
when you're finished with them:
unset($_GET, $_POST);
Or, if you need it to not be undefined after you're done, just set it to an empty array:
$_GET = [];
$_POST = [];
Alternatively, if you just want to rename $_GET
and $_POST
to a different name, but retain the contents, there's a much easier way to do this with PHP's array clone
function:
$input_arr1 = clone $_GET;
$input_arr2 = clone $_POST;
This way you don't have to write out a foreach
.
Upvotes: 1