This is available as Str\reverse in the www repository.
Str\reverse
Reverse a string by bytes
namespace HH\Lib\Str; function reverse( string $string, ): string;
string $string
string