public function hex2bin($hex)
    {
        $binLen = ceil(mb_strlen($hex) / 2);

        // size validation while creating
        $buffer = Buffer::fromHex($hex, $binLen);
        return $buffer->getBinary();
    }
public function hex2bin($hex)
    {
        $binLen = ceil(mb_strlen($hex) / 2);

        // size validation while creating
        $buffer = Buffer::fromHex($hex, $binLen);
        return $buffer->getBinary();
    }
public function hex2bin ( $ hex ) { $ binLen = ceil ( mb_strlen ( $ hex ) / 2 ) ; // size validation while creating $ buffer = Buffer :: fromHex ( $ hex , $ binLen ) ; return $ buffer -> getBinary ( ) ; }
Encode a Hexadecimal string to corresponding string characters
using the Buffer class as a backbone.

@param   string  $hex
@return  string
Encode a Hexadecimal string to corresponding string characters using the Buffer class as a backbone .