3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $sampleFunction = function(int $a, int $b, int $c) { return sprintf("a=%d; b=%d; c=%d", $a, $b, $c); }; $partialFunction = function(Closure $function, int $argument) { return function(...$args) use ($function, $argument) { return $function($argument, ...$args); }; }; $p = $partialFunction($sampleFunction, 1); $p1 = $partialFunction($p, 2); $p2 = $partialFunction($p1, 4); echo $p2();

preferences:
52.97 ms | 402 KiB | 5 Q