Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create variables from POST

Tags:

post

php

I've got an old script here, which's based on the functionality that it creates variables from the POST Array. I know it's old and shouldn't be used, but which parameter do I need to activate it? $_POST['output'] should automatically become $output.

I've been searching on php.net and google, but I can't seem to find the name of this parameter.

like image 717
Ahatius Avatar asked Dec 21 '22 22:12

Ahatius


1 Answers

Easy

extract($_POST);

Now

echo $output;

EDITS :

The above method has been deprected now. It can be achieved like this

extract(array_intersect_key($_POST, $array_of_expected_keys))
like image 198
Muhammad Raheel Avatar answered Jan 03 '23 04:01

Muhammad Raheel