PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Class A{
var $value;
function A($val){
$this->value = $val;
}
function getValue(){
return $this->value;
}
}
Class B{
var $aray = array();
function B(){
$this->aray[] = new A(4);
$this->aray[] = new A(2);
$this->aray[] = new A(7);
}
function getArray(){
return $this->aray;
}
}
$obj = new B();
$myaray = $obj->getArray();
echo $myaray[0]->getValue(); // this will not recognise 'getValue()' as method
Can you please tell me why this happened.
Thanks in advance...
Last edited by harrisonad on Thu Mar 17, 2005 11:15 pm, edited 1 time in total.