in is_mobile(); strpos would return false if the string is not found, but would return 0 if the string is in the first character

0 still means false, so i changed it to a typed comparation to false (!==, notice the extra equal sign).

in that case, you don't have to bother with another if to assign $is_mobile, so i changed it to a direct assignment