- If I'm getting your question right, you need to remove the lines which contain words with white spaces and the blank lines too.
- As you are getting an array of lines, you can simply iterate through it & check if it contains spaces; if so, remove that array element.
Here's a simple reproduction of your scenario -
<?php
$lines = ["LoremIpsuissimplydummytextoftheprintingandtypesettingindustry.",
"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,",
"when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries,",
"but also the leap into electronic typesetting, remaining essentially unchanged.",
"It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,",
"and more recently with desktop publishing"];
foreach($lines as $k => $v) {
if(preg_match('/\s+/', $v)) {
unset($lines[$k]);
}
}
var_dump($lines);
?>
This code will remove all the lines with one or more consecutive white spaces. So, it will output only the lines without spaces -
array(1) { [0]=> string(62) "LoremIpsuissimplydummytextoftheprintingandtypesettingindustry." }