PHP String Formatter
<?php
function format($format, $value, $separator=' ')
{
$temp=[];
foreach ($format as $cluster){
$formattedCluster=substr($value,0,strlen($cluster));
$value=substr($value,strlen($cluster));
array_push($temp, $formattedCluster);
}
return join($separator, $temp);
}
var_dump(format(['xx', 'xxx', 'xxx','xxx','xx'], '6282222222222'));INFO