<?php
$strings = ['This is. a. test.',
'This is a........... test.',
'This is. a test',
'This is a test',
'This. is... a. test.'
];
foreach ($strings as $string) {
if (($offset = strpos($string, '...')) !== false) {
echo "Yes, found 3 in a row ($string -> $offset)";
} else {
echo "Nope, no occurrence of 3 dots in a row ($string)";
}
echo "\n";
}
Nope, no occurrence of 3 dots in a row (This is. a. test.)
Yes, found 3 in a row (This is a........... test. -> 9)
Nope, no occurrence of 3 dots in a row (This is. a test)
Nope, no occurrence of 3 dots in a row (This is a test)
Yes, found 3 in a row (This. is... a. test. -> 8)