/**
 * Workaround with little-endian and big-endian GUID representations
 * AABBCCDD-AABB-AABB-AABB-AABBCCDDEEFF
 * DDCCBBAA-BBAA-BBAA-AABB-AABBCCDDEEFF
 *
 * @param string $hexstr
 * @return string
 */
function swapEndian( $hexstr )
{
  $p = explode('-', $hexstr);

  $p[0] = implode('', array_reverse(explode('.', chunk_split($p[0], 2, '.'))));
  $p[1] = $p[1]{2}.$p[1]{3}.$p[1]{0}.$p[1]{1};
  $p[2] = $p[2]{2}.$p[2]{3}.$p[2]{0}.$p[2]{1};

  return implode('-', $p);
}