If I use PHP's extract() function to import a variable from an array, will a variable with the same name be overwritten? The reason I ask is because I'm trying to initialize all of my variables.
Thank you for your time.
By default it will overwrite.
http://php.net/extract
If
extract_type[the second argument] is not specified, it is assumed to beEXTR_OVERWRITE
See the linked page for other options
The default is to overwrite, however you can change this action to one of several possiblities, by telling the function how to handle collisions:
for example passing EXTR_SKIP as the second parameter e.g extract($array,EXTR_SKIP) will cause collisions to be skipped.
The full usage is detailed here : http://php.net/manual/en/function.extract.php
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