Example #1
0
 /**
  * Subtract a distance
  * @param Distance $distance Another Distance object
  * @return Distance Returns a new Distance object of same unit as current Distance
  */
 public function subtract(Distance $distance)
 {
     $value = $this->value - $distance->to($this->unit)->value();
     return new Distance($value, $this->unit);
 }