Make your own free website on Tripod.com
Home     My Faqts     Contributors     About     Help    

FAQTS : Computers : Programming : Languages : PHP : Language and Syntax : General

Entry Add Entry Alert - Edit this Entry

Did You Find This Entry Useful?

6 of 6 people (100%) answered Yes
Recently 2 of 2 people (100%) answered Yes

How to evaluate a php script within another script, and pass arguments to the first?

Sep 20th, 1999 04: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! ;)



© 1999-2000 Synop Software