Hello,
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.
Hello,
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.
If
extract_type[the second argument] is not specified, it is assumed to beEXTR_OVERWRITE
See the linked page for other options
This depends entirely on the extract_type value you use. The default, however, is to overwrite.
That depends on the second argument you pass to the function. extract() takes an optional second argument consisting of constants. See the docs at http://us2.php.net/manual/en/function.extract.php
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 paramater 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
Thank you everybody. I only glazed over this info earlier and I hadn't to of even asked if I went to the manual and reviewed the function. Quick responses here :)