Skip to content

Instantly share code, notes, and snippets.

@bbatsche
Created January 30, 2014 19:08
Show Gist options
  • Save bbatsche/8716454 to your computer and use it in GitHub Desktop.
Save bbatsche/8716454 to your computer and use it in GitHub Desktop.
<?php
class DoMath {
public $var;
public static $boo;
public function addToVar($value) {
// $this->var += $value;
}
public static function add($valueA, $valueB) {
return $valueA + $valueB;
}
public static function addToIt($value) {
static::$boo += $value;
}
}
$obj = new DoMath();
$obj->var = 5;
var_dump($obj->var);
$obj->addToVar(7);
var_dump($obj->var);
var_dump(DoMath::add(9, 2));
var_dump(DoMath::addToIt(4));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment