faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

9 of 17 people (53%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How do I retrieve a single variable value from another file?

Feb 26th, 2008 00:02
dman, Michael Wales, John Reikes, http://www.ttnr.org


Say the file you need the variable from is called file2.php, I would 
insert the following line into file1.php:
<?
  require("file2.php");
  echo $var;
?>
Then in file2.php you would have to have a line similar to this:
<?
  $var = "value";
?>