I have foreach
with equal results being printed, I need to change the ones that are the same.
An example of the code is this:
foreach ($courses as $key => $course) {
var_dump($course->fullname);
}
Inside the foreach the result is this giving a var_dump($course->fullname);
string(6) "Nome 1"
string(6) "Nome 2"
string(6) "Nome 1"
This is var_dump($course);
array(3)
{ [1]=> object(stdClass)#442 (1) { ["fullname"]=> string(6) "Nome 1" }
{ [2]=> object(stdClass)#443 (1) { ["fullname"]=> string(6) "Nome 2" }
{ [3]=> object(stdClass)#444 (1) { ["fullname"]=> string(6) "Nome 1" }
}
How do I change the fullname
of the same results?