public static function Af2a($s, $ideg, $iamin, $asec, &$rad) {
    /* Compute the interval. */
    $rad = ( $s == '-' ? -1.0 : 1.0 ) *
            ( 60.0 * ( 60.0 * ( (double)abs($ideg) ) +
            ( (double)abs($iamin) ) ) +
            abs($asec) ) * DAS2R;

    /* Validate arguments and return status. */
    if ($ideg < 0 || $ideg > 359)
      return 1;
    if ($iamin < 0 || $iamin > 59)
      return 2;
    if ($asec < 0.0 || $asec >= 60.0)
      return 3;
    return 0;
  }