I have looked as an example provided here How do I check if a string contains a specific word? and tried to implement the same logic in my code.
However, the results that I get is not what I would have expected.
My code looks following
foreach ($files as $file_name) {
require_once "Classes/PHPExcel.php";
$tmpfname = "./product_files/".$file_name;
//echo $tmpfname;
//die();
$excelReader = PHPExcel_IOFactory::createReaderForFile($tmpfname);
$excelObj = $excelReader->load($tmpfname);
$worksheet = $excelObj->getSheet(0);
$lastRow = $worksheet->getHighestRow();
echo $file_name;
if (strpos($file_name, 'aroundnoon' !== false)) {
echo 'Aroundnoon </br>' ;
}
else if (strpos($file_name, 'classic_drinks' !== false)) {
echo 'Classic Drinks </br>' ;
}
else
{
echo 'This is stupid.. </br>';
}
}
The file names are aroundnoon.xlsx and classic_drinks.xlsx however when I run this file, I get the following results
Where am I going wrong?