I am running PHP 7.0.22, under LAMP, on two ubuntu 16.04.
My PHP code is as follows
$str="ls -1 /var/www/dropbox | egrep '*.CEL|*.cel'";
$result= explode(PHP_EOL, shell_exec($str));
$fileNames=$result;
print_r($fileNames);
echo "<br>";
$inputFileCount=count($fileNames,1);
echo "<br>";
echo "File count:" . print_r($inputFileCount);
echo "<br>";
I get the following on the screen
Array ( [0] => prefix1.cel [1] => prefix12.cel [2] => )
File count:1
It seems to me that the count should be 2.