public static function Gd2gce($a, $f, $elong, $phi, $height, array &$xyz) {
    $sp;
    $cp;
    $w;
    $d;
    $ac;
    $as;
    $r;

    /* Functions of geodetic latitude. */
    $sp = sin($phi);
    $cp = cos($phi);
    $w  = 1.0 - $f;
    $w  = $w * $w;
    $d  = $cp * $cp + $w * $sp * $sp;
    if ($d <= 0.0)
      return -1;
    $ac = $a / sqrt($d);
    $as = $w * $ac;

    /* Geocentric vector. */
    $r      = ($ac + $height) * $cp;
    $xyz[0] = $r * cos($elong);
    $xyz[1] = $r * sin($elong);
    $xyz[2] = ($as + $height) * $sp;

    /* Success. */
    return 0;
  }