compose but right-to-left. Useful when the natural reading order of your callables is the opposite of their execution order (e.g. mathematical function notation).
Like compose() but threads the value through callables right-to-left — the last callable is applied first.
/**
* @param callable(mixed):mixed ...$callables
* @return Closure(mixed):mixed
*/
GeneralFunctions\composeR(callable ...$callables): ClosureWhen GeneralFunctions\composeR() is called, it returns the following Closure which can be used like a regular function.
/**
* @param mixed $value
* @return mixed
*/
$function ($value)This can be used to create a simple closure which can be used as a regular function.
$shoutTrimmed = GeneralFunctions\composeR(
'strtoupper',
'trim'
);
// Equivalent to strtoupper(trim(' foo '))
echo $shoutTrimmed(' foo '); // 'FOO'