Question: I have this simple for loop to echo an array:

```
for ($i = 0; $i < count($director); $i++) {
   echo '<a href="person.php?id='.$director[$i]["id"].'">'.$director[$i]["name"].'</a>';
}

```

The problem here is that when more than one element is in the array then I get everything echoed without any space between. I want to separate each element with a comma except the last one.

I can't use `implode` so I'm looking for another solution

Answer: 
A better solution is to avoid looping altogether. I've ignored building the links for the sake of clarity. Note that I don't believe the inability to use implode is a condition. I believe it's a simple statement of, "I can't see how to make this work using implode, so I did it this way instead."

```
$last_entry = array_pop($director);
if(count($director) > 0) {
    echo implode(", ", $director) . " and " . $last_entry;
} else {
    echo $last_entry;
}

```
```
foreach ($strings as $string){
    $superstring .= $string . ', ';
}
$echostring = substr_replace($superstring ,"",-2);
echo $echostring;

```