I have this problem. I want to echo the value of the specific index of an array. my code is this.
<?php
$str = 'test1:val1,test2:val2,test3:val3'
$ex1 = explode(',',$str);
foreach($ex1 as $val){
$ex2 = explode(':',$val);
foreach($ex2 as $val2){
echo $val2.'<br>';
}
}
//the output will be
/*
test1
val1
test2
val2
test3
val3
*/
?>
But I want the output to be only test1,test2,test3. Plss someone help me.
</div>