Wrote a little snippet that replaces all strings in an array, and finally outputs them as a comma separated string (shown below).
It seems a bit much though for such simple functionality. So my question is can anyone come up with a more elegant way of writing this?
$arr = array('first', 'second', 'third');
$size = count($arr);
$newArr = array();
for($i=0; $i<$size; $i++) {
$newArr[$i] = str_replace($arr[$i], '?', $arr[$i]);
}
$final = implode(', ', $newArr);
echo $final;
$arr[$i]as both the needle and input string.