示例#1
0
function ack($m, $n)
{
    if ($m == 0) {
        return $n + 1;
    }
    if ($n == 0) {
        return ack($m - 1, 1);
    }
    return ack($m - 1, ack($m, $n - 1));
}
示例#2
0
function notifications($data)
{
    //debug
    $n = (array) $data;
    debug("payload: " . print_r($n, true));
    //define response
    $response = null;
    //multiple notifications
    if (is_array($data->Notification)) {
        $response = array();
        for ($i = 0; $i < count($data->Notification); $i++) {
            array_push($response, ack(process_notification($data->Notification[$i])));
        }
    } else {
        $response = ack(process_notification($data->Notification));
    }
    return $response;
}
示例#3
0
function ackermann($n = 7)
{
    $r = ack(3, $n);
}
示例#4
0
function ackermann($n = 7)
{
    $r = ack(3, $n);
    print "ack(3,{$n}): {$r}\n";
}
示例#5
0
function ack($m, $n){
   if($m == 0) return $n+1;
   if($n == 0) return ack($m-1, 1);
   return ack($m - 1, ack($m, ($n - 1)));
}