$hexadecimal = 'afc758'; $binary = base_convert($hexadecimal, 16, 2); echo $hexadecimal . ' -> binary value is: ' . $binary;