Пример #1
0
/**
 * Documented function
 */
function duplicate($p1, $p2, $p3)
{
    $a = $p1 + $p2;
    $b = doSomething($p3);
    while ($p1 < $p2) {
        $p1++;
    }
    return valueOf($a) - $b;
}
Пример #2
0
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";
}
Пример #3
0
/**
 * 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));
}