note 60529 deleted from function.include by nlopess
| From: | nlopess@php.net | Date: | Tue, 10 Jan 2006 18:35:31 +0000 |
| Subject: | note 60529 deleted from function.include by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101503@lists.php.net to get a copy of this message | ||
Note Submitter: felipe at spdata dot com dot br
----
If you want to use variables from one include in another at a main page, you have to use the global
keyword.
Example:
<?php
//include1.php
$a = 'cross include test';
?>
<?php
//include2.php
global $a; //without this won't print anything
echo $a;
?>
<?php
//main.php
include('include1.php');
include('include2.php');
?>