Array not the same in included file
Posted: Wed Dec 16, 2009 3:36 am
Hello guys,
I'm new here and i recently started php programming and i've come across a problem that i can't seem to solve.
Please help me. I dont know why this error occurs...
i have a file called stats.php were i have a 2D array with a lot of values in.
i get the values from the array by using the key (string)
like this, i.e. $value = $stats["a"]["b"];
further down i have included another file: file2.php.
when im in file2.php some of the array values aren't there anymore...
$stats["a"]["b"] may not have a value in file2.php
why?
so if i make a funtion that returns the stats from file2.php to stats.php
and compares them they are not similar.
stats.php looks something like this:
include('file2.php');
$stats2 = getstats(); //function that returns $stats from file2.php
if($stats["a"]["b"] != $stats2["a"]["b"])
echo "<br/>WHY DOES THIS HAPPEN???<br/>";
hope it makes sense to u...
thx for the help.
I'm new here and i recently started php programming and i've come across a problem that i can't seem to solve.
Please help me. I dont know why this error occurs...
i have a file called stats.php were i have a 2D array with a lot of values in.
i get the values from the array by using the key (string)
like this, i.e. $value = $stats["a"]["b"];
further down i have included another file: file2.php.
when im in file2.php some of the array values aren't there anymore...
$stats["a"]["b"] may not have a value in file2.php
why?
so if i make a funtion that returns the stats from file2.php to stats.php
and compares them they are not similar.
stats.php looks something like this:
include('file2.php');
$stats2 = getstats(); //function that returns $stats from file2.php
if($stats["a"]["b"] != $stats2["a"]["b"])
echo "<br/>WHY DOES THIS HAPPEN???<br/>";
hope it makes sense to u...
thx for the help.