Create UUID from an existing MD5 sum in PHP

This code snippet will create a function that allows you to convert an MD5 checksum into a UUID formatted string. MD5 sum lengths are 32 characters. UUID string lengths are 32 characters excluding dashes and 36 with dashes. UUID strings are in the format of 8-4-4-4-12.

function uuid_make($string){
  $string = substr($string, 0, 8 ) .'-'.
  substr($string, 8, 4) .'-'.
  substr($string, 12, 4) .'-'.
  substr($string, 16, 4) .'-'.
  substr($string, 20);
  return $string;
}

Then to use the function to generate a UUID, pass an MD5 checksum to it.

uuid_make(md5($someString));