<!DOCTYPE html><html><head></head>
<body><?php
$s = 'XXabYYacadZZ';
print_r(preg_split('/a./',$s));
echo "<br />";
print_r(preg_split('/a./',$s,2));
echo "<br />";
print_r(preg_split('/a./',$s,0,PREG_SPLIT_NO_EMPTY));
echo "<br />";
print_r(preg_split('/a.(..)/',$s,0, PREG_SPLIT_DELIM_CAPTURE));
echo "<br />";
print_r(preg_split('/a./',$s,0, PREG_SPLIT_OFFSET_CAPTURE));
echo "<br />";
?> </body></html>
<!DOCTYPE html><html><head></head>
<body><?php
$s = 'XXabYYacadZZ';
print_r(preg_split('/a./',$s));
echo "<br />";
print_r(preg_split('/a./',$s,2));
echo "<br />";
print_r(preg_split('/a./',$s,0,PREG_SPLIT_NO_EMPTY));
echo "<br />";
print_r(preg_split('/a.(..)/',$s,0, PREG_SPLIT_DELIM_CAPTURE));
echo "<br />";
print_r(preg_split('/a./',$s,0, PREG_SPLIT_OFFSET_CAPTURE));
echo "<br />";
?> </body></html>
Array ( [0] => XX [1] => YY [2] => [3] => ZZ )
Array ( [0] => XX [1] => YYacadZZ )
Array ( [0] => XX [1] => YY [2] => ZZ )
Array ( [0] => XX [1] => YY [2] => [3] => ad [4] => ZZ )
Array ( [0] => Array ( [0] => XX [1] => 0 )
[1] => Array ( [0] => YY [1] => 4 )
[2] => Array ( [0] => [1] => 8 )
[3] => Array ( [0] => ZZ [1] => 10 ) )