in_array() - help on what specifically would return true
- by Kerri
I am using in_array, and I'm trying to use it in a way where it will only return true if it's an exact match of one of the objects in the array, not just if it's "in" the array.
e.g.
1. $sample_array = array('123', '234', '345');
2. $sample_array = array('23', '34', '45');
in_array('23', $sample_array);
In the above example, I would only want version 2 to return true, because it has the exact string, '23'.
Version 1 returns true as well though, because the array contains instances of the string '23'.
How would I get this to work so that only version 2 returns true? Am I even using the right function?