Most of the developers know how to work with PHP Sessions, but don’t know or don’t care to understand how PHP manages to make sessions work.
HTTP is a stateless protocol, due to which its is unable to understand subsequent requests from the same user/client. It considers all requests as “NEW”. So to manage this ‘state’, Sessions and cookies come into the picture.
Please read more over here How Sessions work in PHP