<?php $str = '11131221133112'; var_export( preg_replace( '/(\d)\1*\K(?!$)/', ' ', $str ) );
You have javascript disabled. You will not be able to edit any code.