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 Corso {
protected $_nome;
protected $_tipologia;
protected $_moduli = array();
public function __construct($nome, $tipologia) {
$this->_nome = $nome;
$this->_tipologia = $tipologia;
}
public function setModuli(array $moduli) {
foreach($moduli as $ii => $moduli) {
if (!($moduli instanceof Modulo)) {
throw new Exception("Elemento in indice $ii non è una valida istanza della classe modulo");
}
else{
$this->_moduli[] = $moduli;
}
}
}
public function getModuli() {
return $this->_moduli;
}
}
As you can view in the code, $_moduli is an array of objects... How i can access to this data? Foreach doesn't work...