Answer the question
In order to leave comments, you need to log in
How to exclude empty string from output?
Tell me how to exclude an empty line with random output, that is, there is a csv file
in the file there is an entry of type
1; fork
2; plate
3; spoon
and the fourth line are empty, the line break
has already twisted and this way and that all the same skips the empty line
here is the code itself
$out = " ";
$list = explode("\n",$data);
$arr = array_map('trim', $list);
shuffle($arr);
srand ((float) microtime() * 10000000);
for($i=0; $i<1; $i++)
{
if(!strripos($arr[$i], "<|>")) continue;
if (!isset($arr[$i])) break;
$elem = explode('<|>',$arr[$i]);
$out .= ("<a style=color:".$elem[1]."; href=".$elem[2]." target='_blank' title=".$elem[3]."><b>".$elem[4]."</b> ".$elem[5]."</a>");
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question