Hello devs,
In this tutorial, I will discuss about PHP extract function. You know that PHP extract() function imports variables into the local symbol table from an array. This PHP extract function uses array keys as variable names and values as variable values.
So using this extract function, we can print arrays by calling a variable name. From this example you will also see how to php array extract specific keys. It's a great feature of PHP.
We can convert array to variables in PHP using this extract function. Let's see the example code of PHP extract.
$my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse");
extract($my_array);
echo $a;
echo $b;
echo $c;
Now if you run this code, the output will be:
Read also: Brief Explanation of PHP Array Destructuring
Hope it can help you.
#php