Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class getExample {
- private $_values = array();
- public function __get($key) {
- return $this->_values[$key];
- }
- public function __set($key,$value) {
- $this->_values[$key]=$value;
- }
- public function __call($method,$parameters) {
- if (preg_match('/^get/',$method)) {
- $key = preg_replace('/^get/','',$method);
- $this->__get($key);
- } elseif (preg_match('/^set/',$method)) {
- $key = preg_replace('/^set/','',$method);
- $this->__set($key,$parameters[0]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement