Alex Rivera | Logout

Can echo size of SESSION?

Asked 2009-09-06T18:55:12.627
12

I dont know if my sessions are too big. Is there a way to see the size of a session. Thanks, Rahul

Edit
Report

1 Answer

20
$size_of_session_estimate = strlen( serialize( $_SESSION ) );

Now, this is just an estimate, as the serialize handler is not used to serialize sessions, but it also won't be too far off.

That being said, unless you're storing a silly amount of data in the session, you probably don't need to worry about this.

answered 2009-09-06T18:57:43.073

Your Answer