I want to change the string into array after using foreach() so how is it done?
$g = "";
$changer = explode(",", $g);
foreach ($y as $key => $c) {
foreach ($c['movie'] as $rr) {
$g .= $rr->movieName . ",";
}
}
I want to change the string into array after using foreach() so how is it done?
$g = "";
$changer = explode(",", $g);
foreach ($y as $key => $c) {
foreach ($c['movie'] as $rr) {
$g .= $rr->movieName . ",";
}
}
Based on your answer, theres a much easier way to do it than what you're doing:
foreach ($y as $key => $c) {
foreach ($c['movie'] as $rr) {
$changer[] = $rr->movieName;
}
}