/** * Returns the minimum value of this list. Result is undefined * for non numeric lists. * @return string * @throws \UnderflowException */ public function min() { if ($this->isEmpty()) { throw new \UnderflowException(\get_called_class() . ' is empty'); } $min = $this->front(); for ($i = 1, $l = $this->count(); $i < $l; ++$i) { if (Number::lessThan($this->_Arr[$i], $min)) { $min = $this->_Arr[$i]; } } return $min; }
public function testLessThan() { $l = '2387432479223'; $r = '3845987346534875'; $this->assertTrue(Number::lessThan($l, $r)); $l = '3845987346534875'; $r = '2387432479223'; $this->assertFalse(Number::lessThan($l, $r)); $l = '3845987346534875'; $r = '3845987346534875'; $this->assertFalse(Number::lessThan($l, $r)); }