I feel like this implementation is a bit too complicated (and due to the method calls slower than necessary). Maybe use a boolean flag like `$first` instead?

```
$str = '';
$first = true;
foreach ($iterable as $value) {
     if ($first) {
         $str .= $value;
         $first = false;
     } else {
         $str .= $glue . $value;
     }
     return $str;
}
```