Quantcast
Channel: PHP getter and setter - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer 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



Answer 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 Article

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 Article
Browsing all 3 articles
Browse latest View live




Latest Images