So, here I am, I've been programming PHP for 6 years, and have never
gotten into classes. Well, I finally decided to take the plunge, and
here's my very first newbie question. How come this works (not in a
class):
$x = array("a" => array(), "b" => array());
$z = &$x['b'];
$x['b'][0] = "test";
echo $z[0];
And this doesn't:
class Phorm {
var $dSpace, $dEmail, $dValid, $dAckPg, $dDBLog, $dTXLog;
function PhormProcessor( ) {
$this->dSpace = array(
"EMail" => array(),
"Valid" => array(),
"AckPg" => array(),
"DBLog" => array(),
"TXlog" => array()
);
$this->dEmail = &$this->dSpace['EMail'];
$this->dValid = &$this->dSpace['Valid'];
$this->dAckPg = &$this->dSpace['AckPg'];
$this->dDBLog = &$this->dSpace['DBLog'];
$this->dTXLog = &$this->dSpace['TXlog'];
}
}
$Phorm = new Phorm;
$Phorm->dSpace['Email'][0] = "test";
echo $Phorm->dEmail[0];
--
Alan Little
Phorm PHP Form Processor
gotten into classes. Well, I finally decided to take the plunge, and
here's my very first newbie question. How come this works (not in a
class):
$x = array("a" => array(), "b" => array());
$z = &$x['b'];
$x['b'][0] = "test";
echo $z[0];
And this doesn't:
class Phorm {
var $dSpace, $dEmail, $dValid, $dAckPg, $dDBLog, $dTXLog;
function PhormProcessor( ) {
$this->dSpace = array(
"EMail" => array(),
"Valid" => array(),
"AckPg" => array(),
"DBLog" => array(),
"TXlog" => array()
);
$this->dEmail = &$this->dSpace['EMail'];
$this->dValid = &$this->dSpace['Valid'];
$this->dAckPg = &$this->dSpace['AckPg'];
$this->dDBLog = &$this->dSpace['DBLog'];
$this->dTXLog = &$this->dSpace['TXlog'];
}
}
$Phorm = new Phorm;
$Phorm->dSpace['Email'][0] = "test";
echo $Phorm->dEmail[0];
--
Alan Little
Phorm PHP Form Processor
Comment