Lower cost on something repeated with larger `$n`:

* `strpos` is constant
* `explode` is linear (small `$n`)

A regex requires compilation and multi-variant conditions.

There may be a way to factor out the `strpos` using `strtok`, which would likely offer even better performance for this heavily-iterated loop.