Skip to content

Instantly share code, notes, and snippets.

@talpah
Forked from anonymous/sad.php
Last active September 21, 2015 12:10
Show Gist options
  • Save talpah/ff573a15ea88b38cafa8 to your computer and use it in GitHub Desktop.
Save talpah/ff573a15ea88b38cafa8 to your computer and use it in GitHub Desktop.
Just noticed that sad() is not called on a class instance
<?php
$thefeels = new Feelings();
function sad() {
global $thefeels;
return $thefeels->is_checked() ? $thefeels : $thefeels->is_sad();
}
class Feelings {
private $sad = true;
private $feelings_checked = false;
public function is_sad() {
$this->feelings_checked = true;
return $this->sad;
}
public function is_checked() {
return $this->feelings_checked;
}
public function stop() {
$this->sad = false;
}
}
function beAwesome() {
// TODO: own version
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment