php - Adding spaces in converted hex -
i have example data converted hex
$convertohex = "##x27,5556789,a89,2*"; $convertedhex = bin2hex($convertohex);
how add spaces can output this
23 23 58 32 37 2c 35 35 35 36 37 38 39 2c 41 38 39 2c 32 2a
thank in advance.
use chunk_split()
function in php split string smaller parts.use code below :
<?php $convertohex = "##x27,5556789,a89,2*"; $convertedhex = bin2hex($convertohex); echo chunk_split($convertedhex, 2, ' '); ?>
hope helps you.
Comments
Post a Comment