[PHP] Converting from Short to Long UUID

Discussion in 'Programming' started by relavis, Jun 5, 2017.

  1. Hey there.

    I am looking for a way to convert from a short UUID (1c1424ef43934d2fa47c0eebcf881737) to a long UUID (1c1424ef-4393-4d2f-a47c-0eebcf881737), preferrably in one string. I'm not great with PHP so I would love some help with this.

    Thanks!
     
  2. I actually solved this myself, and for anyone looking, here's the code:
    Code (Text):
    substr($profile_user[0]->uuid, 0, 8) . "-" . substr($profile_user[0]->uuid, 8, 4) . "-" . substr($profile_user[0]->uuid, 12, 4) . "-" . substr($profile_user[0]->uuid, 16, 4) . "-" . substr($profile_user[0]->uuid, 20, 12);
     
    • Agree Agree x 1