src/mako/utility/UUID.php
public static function toBinary(string $uuid): string
	{
		if(!static::validate($uuid))
		{
			throw new InvalidArgumentException('The provided string is not a valid UUID.');
		}

		$hex = str_replace(['urn:uuid:', '{', '}', '-'], '', $uuid);

		$binary = '';

		for($i = 0; $i < 32; $i += 2)
		{
			$binary .= chr(hexdec($hex[$i] . $hex[$i + 1]));
		}

		return $binary;
	}
public static function toBinary(string $uuid): string
	{
		if(!static::validate($uuid))
		{
			throw new InvalidArgumentException('The provided string is not a valid UUID.');
		}

		$hex = str_replace(['urn:uuid:', '{', '}', '-'], '', $uuid);

		$binary = '';

		for($i = 0; $i < 32; $i += 2)
		{
			$binary .= chr(hexdec($hex[$i] . $hex[$i + 1]));
		}

		return $binary;
	}
public static function toBinary ( string $ uuid ) : string { if ( ! static :: validate ( $ uuid ) ) { throw new InvalidArgumentException ( 'The provided string is not a valid UUID.' ) ; } $ hex = str_replace ( [ 'urn:uuid:' , '{' , '}' , '-' ] , '' , $ uuid ) ; $ binary = '' ; for ( $ i = 0 ; $ i < 32 ; $ i += 2 ) { $ binary .= chr ( hexdec ( $ hex [ $ i ] . $ hex [ $ i + 1 ] ) ) ; } return $ binary ; }
Converts a UUID from its hexadecimal representation to a binary string.

@param  string                    $uuid UUID
@throws \InvalidArgumentException
@return string
Converts a UUID from its hexadecimal representation to a binary string .