I'm using codeigniter and trying to make an if statement for if the controllers have changed. What I have right now gives the error.
if (isset($this->session->userdata('lastUrl')) && $this->session->userdata('lastUrl') != $this->router->class) {
echo 'new controller';
}
$this->session->set_userdata('lastUrl', $this->router->class);
This code is in the constructor of the controller so it will be run on every page.