$arr = array('Hello','World!','Beautiful','Day!');
echo join(", ",$arr);
implode("",$arr);
$arr = array('Hello','World!','Beautiful','Day!');
echo join(",",$arr);
// from PHP 8.0 (order parameters has been changed)
$arr = array('Hello','World!','Beautiful','Day!');
echo join($arr, ", ");
<?php
// implode ( string $separator , array $array )
$res = implode ( ",", $array );
?>
$array1 = [1, 5, 64, 2, 6];
$array2 = [2, 1, 8, 3];
//Method 1:
array_filter($array1, function($_){
global $array2;
return in_array($_, $array2);
}); // Output: [0 => 1, 3 => 2]
//Method 2:
array_intersect($array1, $array2); //Output: [0 => 1, 3 => 2]