Quantcast
Channel: PHP getter and setter - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Zander Rootman for PHP getter and setter

$
0
0

Untested.. Should work though. Using more magic methodology.

class ProjectSettingsViewModel{    protected $ProjectAppCount = 0;    public $ProjectApps = array();    public function __get( $property )    {        switch( $property )        {            case "ProjectAppCount":                return count( $this->ProjectApps );                break;        }    }}

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>