I coded a function (in a CodeIgniter 4 project) which checks on every site-load the session vars, if there are only wanted values.
It works, but normally 99,9% of this function is senseless because no values changed or added.
So I want to ask if there is a simple or more efficient way to monitor if the data of $_SESSION has changed. Maybe as a kind of event or something else?
Is this or nearly this possible (without comparing all values again and again to check if there are changes)?