I'm trying to add a comma between outputs if they exist. If I use implode, comme is display though output string is empty.
$data1 = $_GET['data1']; // red
$data2 = $_GET['data2']; //
$data3 = $_GET['data3']; //
$data4 = $_GET['data4']; // green
$result = implode(', ', array($data1, $data2, $data3, $data4));
echo $result;
// red, , , green :(
// red, green :)
UPDATE I have multiple keys, which is not the same as the duplicate
www.mysite.com/shoes?size=43 > size is 43
www.mysite.com/shoes?material=leather > material is leather
www.mysite.com/shoes?size=44&color=green > size is 44, color is green