Hi,

I want to store the values that are in array($selected) into a single variable($result). How can i do it? Variable of $result should be 4,3,9. I get this error "Notice: Undefined variable: result in C:\wamp\www....".

Thanks

$selected=array("0" => 4, "1" => 3, "2" => 9 );
foreach ($selected as &$value) {
	$result="$result"."$value,";
}
echo $result;

Solved.

for ($i=0;$i<sizeof($selected);$i++) {
	if($i!=0) {
		$strarray=$strarray.",".$selected[$i];
	} else {
		$strarray=$selected[$i];
	}
}

Sorry, I half read this post but is this what you're looking for?

// Creating the array.
$selected = array(4, 3, 9);

// Join the array elements into a string, seperated by commas.
$result = implode(",", $selected);

// Output the result.
echo $result;