Skip to content

Instantly share code, notes, and snippets.

@dshafik
Created January 27, 2012 19:03
Show Gist options
  • Select an option

  • Save dshafik/1690359 to your computer and use it in GitHub Desktop.

Select an option

Save dshafik/1690359 to your computer and use it in GitHub Desktop.
<?php
class ClassName {
function foo()
{
echo __METHOD__, PHP_EOL;
}
function bar()
{
echo __METHOD__, PHP_EOL;
}
}
(new ClassName)->{(time() % 2) ? "foo" : "bar"}();
// For php -r:
'class ClassName { function foo() { echo __METHOD__, PHP_EOL; } function bar() { echo __METHOD__, PHP_EOL; } } (new ClassName)->{(time() % 2) ? "foo" : "bar"}();'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment