I have an array:
array(
'myVar1' => 'value1',
'myVar2' => 'value1',
'myVar3' => 'value3',
);
Is there a built in function in PHP that will make 3 variables e.g. $myVar1, $myVar2, $myVar3 do that when i echo $myVar1; it retuens 'value1'
Obviously I can loop the array and set them accordingly (so please no answers with this), but if there is a internal PHP function that would be great!
extract() is the function:
Import variables into the current symbol table from an array...
Checks each key to see whether it has a valid variable name. It also checks for collisions with existing variables in the symbol table...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With