<?php $x = preg_replace("/(((\\d)\\d)\\d)/", '1=$1, 2=$2, 3=$3 ', "123456 789");echo $x;
Standard input is empty
1=123, 2=12, 3=1 1=456, 2=45, 3=4 1=789, 2=78, 3=7
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!