<?php print_r(preg_split("/(?<=(X))/","XYZ",-1,PREG_SPLIT_DELIM_CAPTURE));
Standard input is empty
Array ( [0] => X [1] => X [2] => YZ )
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!