Check it out at Ideone
$hora = '120034';
$data = '20170508';
$mes = '201704';
$fome = '62992161424';
$array = str_split($hora, 2);
$string = implode(":", $array);
echo $string;
$ano = substr($data, 0, 4);
$mez = substr($data, 4, 2);
$dia = substr($data, 6, 2);
$string = $dia . "/" . $mez . "/" . $ano;
echo $string;
$ano = substr($mes, 0, 4);
$month = substr($mes, 4, 2);
$string = $month . "-" . $ano;
echo $string;
$dois = substr($fome, 0, 2);
$cinco = substr($fome, 2, 5);
$quatro = substr($fome, 7, 4);
$string = $dois . "-" . $cinco . "-" . $quatro;
echo $string;
- str_split - Converts a string to an array with a predetermined length of each array element
- replace() Returns a part of a string
test in the desired PHP version here