Finding my feet with this but i got above error which redirected me to line with the below info.
if(empty($displayData->sa_params->get('slab_enable'));
i'll appreciate some guidance.
thanks!
Finding my feet with this but i got above error which redirected me to line with the below info.
if(empty($displayData->sa_params->get('slab_enable'));
i'll appreciate some guidance.
thanks!
If you are using PHP with a version < 5.5.0, you cannot check a functions return value directly with empty.
Note:
Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error. In other words, the following will not work: empty(trim($name)). Instead, use trim($name) == false.
You have to assign it to a variable first. Further, you are missing a )
.
Try:
$slab_enabled = $displayData->sa_params->get('slab_enable');
if(empty($slab_enabled)) { /*do stuff*/ };
If you do not know, which version you use, you can check with echo phpversion();
In some PHP versions, or configurations of servers, passing function to empty()
causes that error. In that cases best practice is to assign value returned from function to variable and then check if that variable is empty.
Here's an example:
$slab_enable = $displayData->sa_params->get('slab_enable'); //assign to variable
if(empty($slab_enable)) //checking if variable is empty
{
...
}