I've got a problem that I've been working on for a few hours with no solution thusfar. I'll try to explain below.
I have a file, lets say vars.php. Inside that is code like the follows:
Code: Select all
//vars.php
$tmp = 120;
$tmp2 = 160;Code: Select all
//loadVars.php
class loadVars {
var $tmpVar;
function loadVars() {
include 'vars.php';
$this->tmpVar = $tmp;
}}Code: Select all
//outputData.php
class outputData {
function outputData(&$testRef) {
echo $testRef->tmpVar;}}Code: Select all
//Main execution stream
include(loadVars.php);
include(outputData.php);
$testObject = new loadVars();
$output = new outputData($testObject);If anyone has any suggestions, I would greatly appreciate it.
Regards,
Shawn