Skip to content

Instantly share code, notes, and snippets.

@mgdm
Created May 22, 2014 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgdm/54366d295eb0127b4118 to your computer and use it in GitHub Desktop.
Save mgdm/54366d295eb0127b4118 to your computer and use it in GitHub Desktop.
<?php
class CallThing
{
protected $count = 0;
public function __invoke() {
$this->count++;
}
public function getCount() {
return $this->count;
}
}
$c = new CallThing;
$c();
$c();
$c();
var_dump($c->getCount());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment