1
I have a foreach
with equal results being printed, I need to change those that are equal.
An example of the code is this:
foreach ($courses as $key => $course) {
var_dump($course->fullname);
}
Inside the foreach the result is that giving a var_dump($course->fullname);
string(6) "Nome 1"
string(6) "Nome 2"
string(6) "Nome 1"
That’s the 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 can I change fullname
of equal results ?
You want to change the name for example Name1 which has two to another Name?
– novic
yes!!!!!!!!!!!!!!!!!!
– Alan PS
Which name you want to change, there is a pattern, for example has 3 names equal 1 will get the same name and the other two ??
– novic
I will put a suffix in the names, example: "Name 1 - 1", "Name 1 - 2" for all equal, can have several...
– Alan PS