Doing tests, I've found a little buged program.
Can somebody help me ???
The final result becomes (
- FIN REMPLIR ==>
- FIN REMPLIR ==>Array ( [1] => toto )
Regards,
Thierry.
- Code: Select all
<?php
$foo = new bidon();
class bidon {
private $_proprietes = array('_t');
public function __construct() {
foreach ($this->_proprietes as $propriete) $this->$propriete = null;
$this->remplir();
}
public function __set($nom, $valeur ) {
if (!in_array($nom, $this->_proprietes, true)) {
throw new Exception('propriete ' .$nom .' INCONNUE pour objet ClassAllMembres');
}
$this->_proprietes[$nom] = $valeur;
}
public function __get($nom) {
if (!in_array($nom, $this->_proprietes, true)) {
throw new Exception('propriete ' .$nom .' INCONNUE pour objet bidon');
}
return $this->_proprietes[$nom];
}
private function remplir() {
$this->_t [1] = 'toto';
print "<br>FIN REMPLIR ==>";
print_r($this->_t);
}
}
?>