I have the two following files:
main.php
include("functions.php")
__EXTRACT();
echo $testvar;
functions.php
function __EXTRACT(){
extract($_POST, EXTR_SKIP);
}
However, having a form with a textbox called testvar I can’t get the extract function to extract the data.. if I remove the function call and insert it the extract statement directly into main.php it works. The include is not a problem as other functions in it works. Any ideas?
Cheers
You can’t do that: in your case
extract()creates variables inside the__EXTRACT()function, when the function ends those variables are gone.Anyway using
extract()is very rarely a good idea.