I just thought of something else:
PHP5 __get __set, , , . , , , , :
function __get($var) {
if (strpos($var, '-') !== false) {
$underscored = str_replace("-", "_", $var);
return $this->$underscored;
}
}
function __set($var, $val) {
if (strpos($var, '-') !== false) {
$underscored = str_replace("-", "_", $var);
$this->$underscored = $val;
}
}
echo $company->{'address-one'};
echo $company->address_one;
echo $company->{'my-var'};
echo $company->my_var;
, . , , , PHP Reflection -.