This API is part of the Hack Standard Library, not HHVM itself.

Returns a new vec containing the range of numbers from $start to $end inclusive, with the step between elements being $step if provided, or 1 by default

namespace HH\Lib\Vec;

function range<Tv as num>(
  Tv $start,
  Tv $end,
  ?Tv $step = NULL,
): vec<Tv>;

If $start > $end, it returns a descending range instead of an empty one.


  • Tv $start
  • Tv $end
  • ?Tv $step = NULL