If have this array:
$a = array("one", "two", "three");
I want to transform this into this string:
$s = "one, two, three";
Is there a paste function in PHP?
E.g.:
$s = paste($a, sep=", ");
$s = implode(', ',$a); no? (', ' instead of ',')R) this operation is called paste, so why doesn't the documentation for implode contain that common term? Would make finding this so much easier. Thank you for helping me, @Manibharathi!$a = array("one", "two", "three");
foreach($a as $value) {
$string = $string . ($value != '' ? '' : ', ') . $value;
}