<?php
$string = "YOLOTest";
// bad, should print
if (strpos($string, "YOLO") >= 0) {
echo "YOLO!!!\n";
}
// bad, should not print
if (strpos($string, "SWAG") >= 0) {
echo "SWAG!!!\n";
}
// good, should print
$res = strpos($string, "YOLO");
if ($res !== false && $res >= 0) {
echo "YOLO!!!\n";
}
// good, should not print
$res = strpos($string, "SWAG");
if ($res !== false && $res >= 0) {
echo "SWAG!!!\n";
}