function contiguous($array)
{
    $maxUpToIndex = $array[0];
    $contiguous = $maxUpToIndex;
    for ($i = 1; $i < count($array); $i++) {
        $maxUpToIndex = greater($array[$i], $maxUpToIndex + $array[$i]);
        $contiguous = greater($contiguous, $maxUpToIndex);
    }
    return $contiguous;
}
Example #2
0
 public function testGreater()
 {
     $expr = greater('id', 1);
     $this->assertExpr('`id` > "1"', $expr);
 }