Reputation: 294
I have a variable that outputs as 0 type int I have another string that outputs as 0,1,2.
I am trying to find out if the string contains that very integer, both of these are dynamic values and being fetched from database.
I have tried -
if (strpos($string, $int) !== false) {
echo 'true';
}
But it is not working.
Upvotes: 0
Views: 58
Reputation: 1128
You can use type conversion:
if (strpos($string, (string) $int) !== false)
echo 'true';
Upvotes: 1