note 46480 deleted from ref.classobj by didou
| From: | didou@php.net | Date: | Wed, 13 Oct 2004 00:51:45 +0000 |
| Subject: | note 46480 deleted from ref.classobj by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78459@lists.php.net to get a copy of this message | ||
Note Submitter: mek at zopen dot it
----
just in case you need 'a kind of' PUBLIC/PRIVATE access to class vars, here is my idea (I
use this to generate editable forms and then calculate the full object and ->save() to db/fs)
<?
class User {
// dati estratti da ogni view v_Utente_*
var $titolo;
var $nome;
var $cognome;
var $id;
var $fk_anagrafica;
var $login;
var $pwd;
var $datacreazione;
var $datamodifica;
var $lastlogin;
var $active;
function getVars(){
return array_keys(get_object_vars($this));
}
function getPublic(){
$pub = array('titolo', 'nome', 'cognome', 'login',
'pwd');
$allVars = array_keys(get_object_vars($this));
for($i = 0; $i < count($allVars); $i++){
if(in_array($allVars[$i], $pub))
$pubVars[] = $allVars[$i];
}
return $pubVars;
}
}
class Utente_Studio extends User {
var $sid;
var $interno;
var $ruolo;
}
?>
----
Reason: useless example