<?php

$str = "1234123412341234";
echo chunk_split($str, 4, ' ');