For example I want to split following HTML code:
<a href="http://www.google.com">Google</a>
Output should be seperated by spaces as well as angle brackets
Array(
[0] => <
[1] => a
[2] => href="http://www.google.com"
[4] => >
[5] => Google
[6] => <
[7] => /a
[8] => >
Not sure of what you are trying to achieve, but for your example, you can use the option
PREG_SPLIT_DELIM_CAPTURE
that includes captured parts of the delimiter in the result: