in reply to foreach skipping elements
That's how split is documented to work. You will likely want to set a negative LIMIT parameter.