5

How can I do the below using Joomla API JFactory::getApplication()->input;

unset($_GET["variable1"]); 

1 Answer 1

6

TL;DR: there is no equivalent, because it's not needed.

JInput data is by default a reference to $_REQUEST, so it dosen't have own unset method, because it is not needed. Although it would be nice to have $input->unset('variable1'); for completness of API.

You should use plain PHP, e.g unset($_REQUEST['variable1']);. If you have your variable in $_GET, you can unset by that, if you prefer.

Although you can always use $input->set('variable1', null);, but this way PHP carbage collector won't free memory, since variable is still defined.

1
  • 1
    @Malaiselvan This seems like a complete and accurate answer. Is there any reason not to accept this answer? Commented Aug 7, 2018 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.