I am looking for ways to split a string into an array, sort of str_split(), where the chunk sizes are dictated by an array.
I could do that by looping through the string with a bunch of substr() calls, but that looks neither elegant nor efficient. Is there a function that accept a string and an array, like (1, 18, 32, 41, 108, 125, 137, 152, 161), and yields an array of appropriately chopped string pieces?
Explode is inappropriate because the chunks are delimited by varying numbers of white spaces.