<?php$s = '1234';preg_match_all('/(?=(.+$)).?/', strrev($s), $m);foreach(range(sizeof($m[1]), 0) as $i) print strrev($m[1][$i]) . "\n"; ?>
Standard input is empty
1 12 123 1234
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!