Can't use the method return value in write context
you can check this by method_exists()
function
if (method_exists($this->session->userdata('lastUrl')) && $this->session->userdata('lastUrl') != $this->router->class) { echo 'new controller';}
isset
is a special language construct that can only be used on variables or array keys, not methods. This should have the same functionality:
$this->session->userdata('lastUrl') !== null && ...