Skip to content

Instantly share code, notes, and snippets.

@mehranhadidi
Last active May 29, 2017 05:29
Show Gist options
  • Select an option

  • Save mehranhadidi/006ae3bcddb74ad80f2d284cc4b20c48 to your computer and use it in GitHub Desktop.

Select an option

Save mehranhadidi/006ae3bcddb74ad80f2d284cc4b20c48 to your computer and use it in GitHub Desktop.
Create an static call on normal methods php
<?php
class Test
{
static function __callStatic($method, $args)
{
return self::new()->{$method}(...$args);
}
private static function new(...$args)
{
return new self(...$args);
}
public function sayHi()
{
return 'Hi buddy :)';
}
}
echo Test::sayHi();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment