/pipe.php Secret
Created
July 18, 2023 16:27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class p { | |
private array $callables = []; | |
public function __construct(private $value) {} | |
public function p(callable $callable) { $this->callables[] = $callable;return $this;} | |
public function __invoke() { foreach($this->callables as $callable) $this->value=$callable($this->value);return $this->value;} | |
} | |
$remove = ['noindex']; | |
print (new p('noindex, follow')) | |
->p(fn ($x) => explode(', ', $x)) | |
->p(fn ($x) => array_diff($x, $remove)) | |
->p(fn ($x) => implode(', ', $x)) | |
(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment