I'm dealing with this program,Here I'm trying to separate the string email,by ',',and then I'm storing in the array,then appending with 'city' in foreach..
$email='aa,bb,cc,dd';
$a=explode(',',$email);
//echo $a[2];
$result="";
foreach($a as $v)
{
$result .= " city = '$v' ";
echo $result;
}
I'm getting the result as
city = 'aa' city = 'aa' city = 'bb' city = 'aa' city = 'bb' city = 'cc' city = 'aa' city = 'bb' city = 'cc' city = 'dd'
but I want it to be,,
city = 'aa' city = 'bb' city = 'cc' city = 'dd'
Is my code wrong?..please guide me..
echoin the loop. That's why it outputs the progressively growing list.