<p>PHP's explode function returns an array of strings split on some provided substring. It will return empty strings when there are leading, trailing, or consecutive delimiters, like this:</p>
<pre><code>var_dump(explode('/', '1/2//3/'));
array(5) {
  [0]=&gt;
  string(1) &quot;1&quot;
  [1]=&gt;
  string(1) &quot;2&quot;
  [2]=&gt;
  string(0) &quot;&quot;
  [3]=&gt;
  string(1) &quot;3&quot;
  [4]=&gt;
  string(0) &quot;&quot;
}
</code></pre>
<p>Is there some different function or option or anything that would return everything <em>except</em> the empty strings?</p>
<pre><code>var_dump(different_explode('/', '1/2//3/'));
array(3) {
  [0]=&gt;
  string(1) &quot;1&quot;
  [1]=&gt;
  string(1) &quot;2&quot;
  [2]=&gt;
  string(1) &quot;3&quot;
}
</code></pre>

```
```
function not_empty_string($s) {
  return $s !== "";
}

array_filter(explode('/', '1/2//3/'), 'not_empty_string');
```
```