Hi,
I am new in php. I want destroyed session when browser close but not to close tab.

session_destroy()

When a session is completely destroyed is not always up to you. A user himself can decide when he wants to clear all website data. That can be when he closes the browser, but that can also be when he closes a tab. The only thing you have influence on is when you destroy their session, which can be, for example, when they press a "logout" button. But if you do NOT destroy their session, it will live until they clear their cookies/cache/etc.

sessions destroy itself after 30 minutes from time created, or when user closes the browser

sessions destroy itself after 30 minutes from time created, or when user closes the browser

Since when is that so? :o

commented: Reversing the downvote. Harsh wasn't it? +15

sessions destroy itself after 30 min

Since when is that so? :o

its in default configraion for PHP
session.gc_maxlifetime in php.ini

From http://php.net/manual/en/session.configuration.php :

session.gc_maxlifetime specifies the number of seconds after which data will be seen as 'garbage' and potentially cleaned up. Garbage collection may occur during session start (depending on session.gc_probability and session.gc_divisor).

I must admit that I've never looked into this any further than reading what I just quoted. Could you expand a bit more upon this subject? What does "potentially cleaned up" mean, specifically?