Created
January 30, 2014 19:08
-
-
Save bbatsche/8716454 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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