How can make last time online?

how can make last time online for comment?
example: 5 minutes ago to facebook ->Write a comment…

I assume that you are asking about how to show when a user of your site was last online.

The easiest way to do it would be a function, that whenever called, updates the last_online field in user table with the current time stamp.
You can then include a call to that function on every PHP page.

But as you referenced facebook event time. I believe it can be done with an AJAx function.

Store the time stamp, when an event happens.
Make an Ajax function to periodically call a php page, that checks the difference between current time stamp and the stored time stamp and return the value.

Hope it answers your question and makes any sense at all…

I asking about how much time past of send comment, show online like facebook.