I have an array like below:
$number = array(1,2,3,4,5);
I have a value like below:
$my_num = 2;
I want to compare $my_num variable in every $number array.
My expected output like this: No, Yes, No, No, No.
I tried like this:
<?php
if(in_array($my_num, $number))
{
echo 'Yes';
}
else
{
echo 'No';
}
But I can only get 'Yes' from above output.
How should I modify it in order to get my expected output?
foreachloop