PHP Function Chaining with Pipes

$subdomain = explode('.', parse_url('https://blog.sebastiaanluca.com/', PHP_URL_HOST))[0];
$subdomain = 'https://blog.sebastiaanluca.com/'
|> parse_url($$, PHP_URL_HOST)
|> explode('.', $$)
|> reset($$);
$subdomain = take('https://blog.sebastiaanluca.com/')
->pipe('parse_url', PHP_URL_HOST)
->pipe('explode', '.', '$$')
->pipe('reset')
->get();
$subdomain = 'https://blog.sebastiaanluca.com';
$subdomain = parse_url($subdomain, PHP_URL_HOST);
$subdomain = explode('.', $subdomain);
$subdomain = reset($subdomain);
$taken = take('https://blog.sebastiaanluca.com/');

$taken->pipe(parse_url($taken->value, PHP_URL_HOST))
->pipe(explode('.', $taken->value))
->pipe(reset($taken->value))
->value;
define('PIPE_VALUE', '__pipe-' . uniqid());
foreach ($args as $key => $arg) {
if ($arg === PIPE_VALUE) {
$args[$key] = $this->value;
}
}
$subdomain = pipe('https://blog.sebastiaanluca.com/')
->parse_url(PIPE_VALUE, PHP_URL_HOST)
->explode('.', PIPE_VALUE)
->reset(PIPE_VALUE)
->value;

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store