30 seconds of PHP
Click on a snippet's name to view its code.
Return a new function that composes multiple functions into a single callable.
array_reduce() to perform right-to-left function composition.
Curries a function to take arguments in multiple calls.
If the number of provided arguments (
$args) is sufficient, call the passed function,
Otherwise, return a curried function that expects the rest of the arguments.
Returns the memoized (cached) function.
Create an empty cache by instantiating a new array. Return a function which takes a single argument to be supplied to the memoized function by first checking if the function's output for that specific input value is already cached, or store and return it if not. Allow access to the cache by setting it as a property on the returned function.
Call a function only once.
Return a function, which only calls the provided function,
false and sets