Skip to content

Instantly share code, notes, and snippets.

@yornaath
Forked from johanhar/properties-in-php.php
Created March 22, 2012 12:04
Show Gist options
  • Save yornaath/2157940 to your computer and use it in GitHub Desktop.
Save yornaath/2157940 to your computer and use it in GitHub Desktop.
lawl
<?php
public function __get($name, $value) {
if ($name == "tariff" && get_called_class() != get_class($this)) {
return (intval($this->$name) / 100);
} else if ($name == "durationType" && get_called_class() != get_class($this)) {
} else {
return $this->$name;
}
}
public function __set($name, $value) {
if ($name == "tariff" && get_called_class() != get_class($this)) {
$this->$name = (intval($value) * 100);
} else {
$this->$name = $value;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment