function hex2bin($str) {
$bin = "";
$i = 0;
do {
$bin .= chr(hexdec($str{$i}.$str{($i + 1)}));
$i += 2;
} while ($i < strlen($str));
return $bin;
}

Xampp is telling me theres something wrong on the last line (174) which would be the }, but there isn't a problem with it at all