3
I have a foreach
and he has equal results, I want that when he has the same result he make a echo
Code example:
$courses = array('teste', 'teste2', 'teste3', 'teste');
foreach ($courses as $key => $course) {
if ($course == $course) {
echo $course;
}
}
Missing in the example the second comparison variable, in the example I used the same $course->fullname
in the 2 if places
EDIT: I need if to identify the 2 values 'test' and give a echo
Edit your code as you are doing it, please.
– Diego Souza
Does this second variable have its value changed? is a foreach inside another?
– rray
Edit the question and mount a closer example of the real code if you can’t show it. You can even suggest a
array_intersect()
or related.– rray
I put together another example... @rray
– Alan PS
The goal is to find equal values in an array?
– Daniel Omine
yes!!!!!!!!!!!!
– Alan PS