0

I need to unset a variable from $_GET, $_POST and $_REQUEST.

As if now I do it simply by calling unset three time.

unset( $_GET['add-to-cart'] );
unset( $_POST['add-to-cart'] );
unset( $_REQUEST['add-to-cart'] );

Is there any simple code for doing this ?

Right now creating a custom function only seem to be the alternative to me, Is there any single line code for this ?

Thank You

1
  • 1
    Why not just use $_REQUEST consistently, and only unset it from there? Commented Jul 15, 2018 at 12:51

1 Answer 1

1

You could put it in one line:

unset($_GET['add-to-cart'], $_POST['add-to-cart'], $_REQUEST['add-to-cart']);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.