What do you think that I create an array of regexp patterns and foreach it, then within foreach I I use preg_split to remove quoted parts of email instead of that loop you see on that page?
If yes, then if a pattern matches and the message is splited I have to break the loop, but preg_split does not return true/false that I can use it in an IF statement to check if it already matches a pattern to break the loop. so how should I break the loop of patterns with preg_split? How to improve the loop of that code block not necessarily preg_split?
In other words, move the preg_split (or whatever) into a function written so that it returns what you want it to return.
Then call that function inside the loop
If this were you, which one do you go with? just keep that loop with preg_match as it is on the link I gave? or you’d re-write it with preg_split with callback as you said?
Well, you are more familiar with the code than I am so you would know better than I.
eg. I don’t know why there are matches being captured that apparently aren’t being used.
But one thing I might try is consolidating the eight regex ifs into one something like