Urlencode everything but slashes?

php, urlencode

Solution

- Split by `/`

- `urlencode()` each part

- Join with `/`

Problem

Is there any clean and easy way to `urlencode()` an arbitrary string but leave slashes (`/`) alone?

Original source