sanjeev
sanjeev

Reputation: 4621

Unset same variable from different array

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

Upvotes: 0

Views: 23

Answers (1)

Polaris
Polaris

Reputation: 1249

You could put it in one line:

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

Upvotes: 1

Related Questions