Adding a character in the middle of a string
$time = "1300"; $time = substr($time,0,2).':'.substr($time,2,2);
Edit:
Here is a general solution to this problem:
function insertAtPosition($string, $insert, $position) { return implode($insert, str_split($string, $position));}
I favor this solution as it is just one function
substr_replace('1300', ':', 2, 0);