I wanna take lines that start with capital and end with dot.
function isCapital($string) {
return preg_match('/^\\s*[A-Z]/', $string) > 0;
}
foreach ($url as $file => $files) {
$lines = file($files);
foreach ($lines as $key => $line) {
if (isCapital($line) && (substr($line, -1) == '.')) {
print_r( $line);
}
}
}
But, it does not work, blank result. What’s wrong?
Replace your
foreach($lines...with this one below: