Browsing index pages (3 articles)
↧
PHP getter and setter
I have a class:class Test{ public $AppCount; public $Apps; // When $AppCount is accessed I want to return count( $this->Apps )}When I access property $AppCount, I want to return count(...
View ArticleAnswer by Zander Rootman for PHP getter and setter
Untested.. Should work though. Using more magic methodology.class ProjectSettingsViewModel{ protected $ProjectAppCount = 0; public $ProjectApps = array(); public function __get( $property ) { switch(...
View ArticleAnswer by Nic Wortel for PHP getter and setter
Unfortunately, PHP does not have the getter and setter syntax you are referring to. It has been proposed, but it didn't make it into PHP (yet).First of all, __get() is only executed if you are trying...
View Article
Browsing index pages (3 articles)