Entry
How to evaluate a php script within another script, and pass arguments to the first?
Sep 20th, 1999 02:18
Stéphane Rondinaud,
The "include" function allow a script to be evaluated within another
script. But I thought it was impossible to pass the included script some
parameters. The trick is that global vars are available to this
inclusion, provided that they are declared "global" in this script.
See:
...
bar="echo Done!"
include("./script/foo.php3");
...
with foo.php3:
<?php
global bar;
print(bar);
?>
then the resulting code will be:
...
bar="echo Done!"
echo Done!
...
May be useful! ;)