Generic Object
Posted on Friday, October 2, 2009 in PHP
class GenericObj {
function __call($method, $args) {
$var = strtolower(substr($method, 4, 1)) . substr($method, 5);
switch (substr($method, 0, 4)) {
case "pull": return $this->{$var}; break;
case "push": $this->{$var} = $args[0]; break;
} // switch
} // call
} // GenericObj

Leave a Comment
You must be logged in to post a comment.