Instead of:
if($httpposi === true) {
you need:
if($httpposi !== false) {
since if it is found in the string, it will return an offset as an integer, and you are doing a strict comparison and strictly an non-zero, positive integer is not equal to the boolean value true
.
8 == true // true
8 === true // false, because 8 is not a boolean
0 == true // false, but we need to know if the needle is at position 0
so:
0 !== false // true, string was found
8 !== false // true, string was found
false !== false // false, string was not found
If the sequence is found at the beginning of the string, the falsy 0
will be returned, thus the need to strictly compare to false
to know that it has not been found at all.
http://ideone.com/QXBs7