-1

First, I use codeigniter when I am trying to use these functions.

if(empty($this->session->userdata('id'))):

When I call the page that contains this code, I'm getting error that is below

Fatal error: Can't use method return value in write context in /var/www/atlet/application/views/common/header.php on line 19 

What is the reason?

1 Answers1

0

empty() only checks variables.

Description

bool empty ( mixed $var )

Determine whether a variable is considered to be empty. A variable is considered empty if it does not exist or if its value equals FALSE. empty() does not generate a warning if the variable does not exist.

If you use it for anything else but variables it will result in a parse error. You cannot use empty() directly on a function's return value.

Try this instead

if($this->session->userdata('id')==''):

r4M0
  • 24
  • 2