May 2017
Intermediate to advanced
340 pages
8h 16m
English
A partial application or partial function application is a technique to reduce the number of arguments of a function or to use partial arguments and create another function to act on the remaining arguments in order to produce the same output as what we would get if it were called with all the arguments at once. If we consider our sum function to be partial, where it is expected to take three parameters, but we can call it with two arguments, and later on add the remaining one. Here is the code sample. The sum function used in this example is from the previous section:
function partial($funcName, ...$args) { return function(...$innerArgs) use ($funcName, $args) { $allArgs = array_merge($args, $innerArgs); return call_user_func_array($funcName, ...Read now
Unlock full access