public static function fromHex($hex)
  {
    $string = "";

    if(strlen($hex)%2 == 1)
    {
      throw new Exception("given parameter '" . $hex . "' is not a valid hexadecimal number");
    }

    foreach(str_split($hex, 2) as $chunk)
    {
      $string .= chr(hexdec($chunk));
    }

    return new self($string);
  }
public static function fromHex($hex)
  {
    $string = "";

    if(strlen($hex)%2 == 1)
    {
      throw new Exception("given parameter '" . $hex . "' is not a valid hexadecimal number");
    }

    foreach(str_split($hex, 2) as $chunk)
    {
      $string .= chr(hexdec($chunk));
    }

    return new self($string);
  }
public static function fromHex ( $ hex ) { $ string = "" ; if ( strlen ( $ hex ) % 2 == 1 ) { throw new Exception ( "given parameter '" . $ hex . "' is not a valid hexadecimal number" ) ; } foreach ( str_split ( $ hex , 2 ) as $ chunk ) { $ string .= chr ( hexdec ( $ chunk ) ) ; } return new self ( $ string ) ; }
Returns the Str based on a given hex value.

@param  string $hex
@throws Exception
@return Str
Returns the Str based on a given hex value .