How to determine if cell is empty or not?

Topics: User Forum
May 16, 2013 at 5:47 AM
Hi there, I would like to ask if there is any way of determining if a cell is empty or not. I tried using the code below but it doesn't work:

$temp = $objPHPExcel->setActiveSheetIndex(0)->getCell(A1)->getValue();
if(is_null($temp) || $temp==''){
echo "Cell is empty";

echo "Cell is not empty";

I hope you could help me in this one. :)
May 16, 2013 at 5:52 AM
Oops! Just don't mind this one, I already got the answer. How silly of me. I just changed is_null($temp) to temp==NULL and it worked. :)
May 16, 2013 at 10:42 PM
I usually use the PHP function empty() for this kind of test. That way if the value is '', NULL, 0, or false it is considered empty. But that may not be what you want.
  • Christopher Mullins