Why isn't this standalone code working:
$link = 'https://google.com';
$unacceptables = ['https:','.doc','.pdf', '.jpg', '.jpeg', '.gif', '.bmp', '.png'];
foreach ($unacceptables as $unacceptable) {
if (strpos($link, $unacceptable) === true) {
echo 'Unacceptable Found<br />';
} else {
echo 'Acceptable!<br />';
}
}
It's printing acceptable every time even though https is contained within the $link
variable.
strpos( $haystack, $needle )
with the other functionin_array( $needle, $haystack )
. As you can see, the order of the arguments is reversed. – Witchy