Is it possible when using preg_split
to return the delimiters into an array in the order that they were found?
So take this for example:
$string = "I>am+awesome";
preg_split("/>|\+/", $string);
and then get an output somewhat like this:
Array(
Array(
0 => "I",
1 => "am",
2 => "awesome"
),
Array (
0 => ">"
1 => "+"
)
)
I realize that I could do the split, and then loop through the original string and add them as they are found, but I am looking for a better way if there is one.