I'm using array foreach to get the value.
foreach($movie as $key=>$value) {
if($key == 0) {
echo $_SESSION['movie'] = $value; //output1
} else {
echo $_SESSION['movie'] = ", ".$value;
}
}
echo $value; //output2
When it echo for output1:
movie1,movie2,movie3
When output 2:
movie3
I would like to use the variable $value outside of foreach but I can't get output1 result, and get only output2 result.
My desired output2:
movie1,movie2,movie3