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

This function is available as Str\chunk() in Facebook's www repository.

Returns a vec containing the string split into chunks of the given size


namespace HH\Lib\Str;

function chunk(
  string $string,
  int $chunk_size = 1,
): vec<string>;

To split the string on a delimiter, see Str\split().


  • string $string
  • int $chunk_size = 1