예제 #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
파일: mixedbag.php 프로젝트: n3b/hiphop-php
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)));
}