Skip to content

Instantly share code, notes, and snippets.

@hikari-no-yume
Created March 20, 2017 20:02
  • Star 72 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
function chaining for PHP 7
<?php declare(strict_types=1);
require_once "✨.🐘";
✨($_)->strlen("foo")->var_dump($_);
<?php declare(strict_types=1);
function ✨(&$_) {
return new class($_) {
private $_;
public function __construct(&$_) {
$this->_ = &$_;
}
public function __call(string $name, array $args): self {
$this->_ = $name(...$args);
return $this;
}
};
}
@mindplay-dk
Copy link

@arzola
Copy link

arzola commented Jun 2, 2017

Awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment