/** * Documented function */ function duplicate($p1, $p2, $p3) { $a = $p1 + $p2; $b = doSomething($p3); while ($p1 < $p2) { $p1++; } return valueOf($a) - $b; }
function permute2($x) { global $max, $ingredients; $n = $x + 1; for ($i = 0; $i < $n; $i++) { $j = $n - $i - 1; $val = valueOf([$i, $j]); if ($val > $max) { $max = $val; //var_dump([$i, $j], $val); } } print "MAX {$max} \n"; }
/** * Raises value from `ok` Result or throws an exception on `fail`. * * @param callable $result * @param string $exceptionClass * @return mixed */ function getOrThrow(callable $result, $exceptionClass = \Exception::class) { if (isOk($result)) { return valueOf($result); } throw new $exceptionClass(valueOf($result)); }