Why implode? Why not [fphp]serialize[/fphp] or [fphp]json_encode[/fphp]? Implode isn’t the only way to get a string representation of an array that can be converted back to an array.
Yes, indeed, though he might be simplifying the example some here. In any event, if those strings contain commas (and they’re free form it seems so they could) implode isn’t the right tool, even with array_column
Who said anything about converting the string back to an array?
That more often going to be the case than not. He hasn’t mentioned why he’s doing this, so I have no point of reference here.
array_column doesn’t provide a comma delimited output either, so at best you could replace array_map with array_column, but you can’t remove implode…unless I am missing something.
My take was that he just wants to print the strings separated by some commas. As you say, he hasn’t mentioned why he’s doing this so why second guess? At the very least, let’s ask Zaggs about his other requirements, if any, before jumping onto the this needs to be reversible, or not-only-comma separated, horse!
Who said anything about removing array_column()? (I’m seeing a pattern emerging! )
On the contrary, I like array_column, that is what I was originally searching for when I looked through the php docs to begin with, but when I didn’t find it, I resorted to array_map. What I meant to imply is you can use array_column and array_map interchangeably in this endeavor, but implode() to my knowledge is the only way to take an array and turn it into a delimited string (apart from coding a loop).
Off Topic:
It’s been a long day, my brain has started to shut down…