Re: arrays in a class
| From: | Thomas Buck | Date: | Wed, 10 Oct 2001 10:46:30 +0000 |
| Subject: | Re: arrays in a class | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70617@lists.php.net to get a copy of this message | ||
Hi,
You don't go into much detail, but here's one method, I suppose (?)
Class AccessArray {
var m_myArray;
function SetElement($name,$value) {
$this->m_myArray[$name] = $value;
}
function GetElement($name) {
return $this->m_myArray[$name];
}
}
$arrayClass = new AccessArray;
$arrayClass->SetElement("name","Thomas");
$arrayClass->SetElement("number","123321);
echo $arrayClass->GetElement("name");
//echos "Thomas"
echo $arrayClass->GetElement("number");
//echos "123321"
Thomas.
Hi, How can i set up and access arrays within a class? can anyone give a quick example. thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net