<?php

error_reporting(-1);

$text = 'abc   123   _';
$hex= bin2hex($text);
$hex = preg_replace('/.{2}/', '$0 ', $hex); // разобьем пробелами для удобства
echo $hex;