if(( (in_array(0,$status_arr)) || (in_array(0,$genstatus_arr)) ) &&
((!in_array(0,$escalation_arr)) || (!in_array(0,$genescalation_arr))) ){
echo 'Something';
}else if(( (in_array(1,$status_arr)) || (in_array(1,$genstatus_arr)) )){
echo 'Something Else';
}
Here I am comparing 0 value in_array and non-zero which is !in_array. The results varies according to if-else condition but does not output expected result.
To avoid this, I tried with the third parameter, true, placing the comparison in strict mode which will not only compare values, but types as well:
How can I check if 0 or 1 exists in some array and do not exist in another array ?
The array values would be like below:
var_dump($status_arr);
array (size=6)
0 => string '0' (length=1)
1 => string '0' (length=1)
2 => string '0' (length=1)
3 => string '0' (length=1)
4 => string '0' (length=1)
var_dump($genstatus_arr);
array (size=6)
0 => string '1' (length=1)
1 => string '1' (length=1)
2 => string '1' (length=1)
3 => string '1' (length=1)
4 => string '1' (length=1)
For the below condition its not working
if( (in_array(0,$status_arr)) && (!in_array(0,$genstatus_arr)) )
Also its not a possible duplicate of IN ARRAY
in_arrayto check value0inside an array is not working. Also!in_array