note 11735 added to include
| From: | php-general at lists dot php dot net | Date: | Mon, 05 Mar 2001 02:53:55 +0000 |
| Subject: | note 11735 added to include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11884@lists.php.net to get a copy of this message | ||
Using PHP 4 on Linux RH 6.2; when I include() a file with a .php extension, it does not pick up the
variable scope. When I change the extension to (eg) .txt, the expected variable scope works...
IE:
====main.php====
<?php
$myPageData="testing";
include ("some/page/somewhere.php");
?>
====somewhere.php=====
<misc html>...
<?php
echo $myPageData; // doesn't work
echo "hmmmm"; // works
?>
<more html>...
Now change main.php to:
====main.php====
<?php
$myPageData="testing";
include ("some/page/somewhere.txt");
?>
====somewhere.txt=====
<misc html>...
<?php
echo $myPageData; // works
?>
<more html>...
Am I missing something here?
http://www.php.net/manual/en/function.include.php