I am trying to create an if-statement to show content if it is not empty. It currently shows the if is empty value.
$openHomeStart = '2012-11-10T01:00:00Z';
if(!empty($openHomeStart)){
echo 'value';
}else{
foreach ($openHomeTimes as $time){
$openHomeDetails .= $time;
}
}
I think you just have your condition the wrong way. You have it outputting “value” if $openHomeStart is not empty. If you want it to iterate over the value (and having a value is the only way you could iterate over it then you just need to remove the ! from your condition.