Need help for adding spaces

Hi, I have this example.


$myhex = "##X27,5556789,A89,2*";

$conhex = bin2hex($myhex);


how can I put spaces so that it would look like this


23 23 58 32 37 2c 35 35 35 36 37 38 39 2c 41 38 39 2c 32 2a

thank you in advance.

Try this:



  $myhex = "##X27,5556789,A89,2*";
  echo $conhex = bin2hex($myhex); 
  echo '<br />';

  for($i2=0; $i2<strlen($conhex); $i2++):

    echo $conhex[ $i2];

    echo $i2 % 2 ? '&nbsp;' : '';

  endfor;

  echo '<br /><br /><br />';


Thank you John_Betong