<?php $str = 'T4MAX'; var_dump(preg_replace('~\d(?=\D*$)~', '$0 ', $str));
Standard input is empty
string(6) "T4 MAX"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!