I set a few session variables in a.php where each of the session variables
is an array of the same size and call b,php. In b.php I get new arrays from
those session variables. I then echoed the contents of the arrays in a
loop. This works fine.
Now, I went to do a require_once where I put the decomposition of the
session variables into an include file and just included that file in b.php
instead of explicitly have those lines there in b.php. The result was the
set of php statements in the include file followed by the contents of the
arrays.
Why do the php code lines show up in the output?
An example of what I am talking about is shown below.
Shelly
First b.php:
------------
$num = $_SESSION['num'];
$var1 = $_SESSION['var1'];
for ($i=0; $i<$num; $i++) {
echo $var1[$i] . "<br>";
}
===============
Second b.php
---------------
require_once("decomp.inc");
for ($i=0; $i<$num; $i++) {
echo $var1[$i] . "<br>";
}
decomp.inc
-------------
$num = $_SESSION['num'];
$var1 = $_SESSION['var1'];
============================
First output:
-------------
value1
value2
=============================
Second output:
-----------------
$num = $_SESSION['num'];$var1 = $_SESSION['var1'];
value1
value2
===============================