Showing posts with label PHP Extract. Show all posts
Showing posts with label PHP Extract. Show all posts

Sunday, June 25, 2017

PHP: Import variables into the current symbol table from an array

PHP: Import variables into the current symbol table from an array

$params = array("x1" => "VALUE OF X1");
extract($params);
echo (isset($x1) ? "X1=".$x1 : "NO X1 DEFINED") . "<BR>";
echo (isset($x2) ? "X2=".$x2 : "NO X2 DEFINED") . "<BR>";

And output would be following:

X1=VALUE OF X1
NO X2 DEFINED