Jonathan de M.
Jonathan de M.

Reputation: 9808

Implode an array range in PHP

Is there an easy way, preferably a one-liner, to implode an array range.

Example:

array(1,4,6,88,51,3,5,48,59,4);

In addition, how would I be able to implode between the first and the third value only?

Upvotes: 0

Views: 2162

Answers (1)

deceze
deceze

Reputation: 522145

implode(',', $range);
implode(',', array_slice($range, 0, 3));

Upvotes: 6

Related Questions