-6

What is the difference between session_id(), session_create_id() and session_regenerate_id() in php ?

I am already on php.net but there is a un-explained and broad definition of these 3 functions which cannot be understand well.

There are also 50% similar questions asked on stack overflow but no answer is accepted.

Can anyone tell in simple words?

Stack Overflow
  • 1
  • 5
  • 23
  • 51
  • 3
    Quicklinks for future access: [session_id](http://php.net/manual/en/function.session-id.php) - [session_create_id](http://php.net/manual/en/function.session-create-id.php) - [session_regenerate_id](http://php.net/manual/en/function.session-regenerate-id.php). – FirstOne Nov 25 '17 at 14:57
  • *"but there is a simple and broad definition of these 3 functions which cannot be understand well."* - It's not simple then. Seeing the edit, this comment as per the original post https://stackoverflow.com/revisions/47487292/1 – Funk Forty Niner Nov 25 '17 at 14:58
  • I am already on php.net. Please read the question carefully. – Stack Overflow Nov 25 '17 at 14:58
  • I have edit my question. Please read again thank you – Stack Overflow Nov 25 '17 at 15:00
  • Open and study the comment left by @FirstOne – Rotimi Nov 25 '17 at 15:00
  • 1
    @RamsésFernández Instead of posting it as a comment, you can flag the question as a possible duplicate. A quick "FYI" ;-) if the community agrees, it could be closed for it. – Funk Forty Niner Nov 25 '17 at 15:01
  • 7
    Possible duplicate of [What is the difference between session\_create\_id and session\_regenerate\_id()?](https://stackoverflow.com/questions/46947421/what-is-the-difference-between-session-create-id-and-session-regenerate-id) – Ramsés Fernández Nov 25 '17 at 15:02
  • 1
    @Fred-ii- Done thanks you :) – Ramsés Fernández Nov 25 '17 at 15:03
  • Now I'm confused why the accepted answer is more detailed than the manual. (Btw, dupe-voting is for consolidation; instead of smearing answer thins across dozens of similar questions.) – mario Nov 25 '17 at 15:15
  • Difference between **session_id()** and **session_create_id()** ??? – Stack Overflow Nov 25 '17 at 15:17

1 Answers1

-3

session_id():

Get and/or set the current session id

session_regenerate_id():

Update the current session id with a newly generated one

session_create_id():

Create new session id

Here is a link to the PHP sessions doc and PHP docs

Fred
  • 397
  • 2
  • 5
  • 17
  • One thing is not clear if **session_id()** sets the session id then why **session_create_id()** ? Both set session id ? Or may be any difference between them ? – Stack Overflow Nov 25 '17 at 15:05
  • accept this answer? no please don't. Check the various duplicates in the comment section – Rotimi Nov 25 '17 at 15:05
  • @Akintunde- The link you shared has no accepted answer. Who is sure that the answer on the link page is correct, ha? – Stack Overflow Nov 25 '17 at 15:07
  • 1
    this answer has been downvoted twice. Is accepting a downvoted low-rated answer the best idea? – Rotimi Nov 25 '17 at 15:07
  • One thing is not clear if session_id() sets the session id then why session_create_id() ? Both set session id ? Or may be any difference between them ? – Stack Overflow Nov 25 '17 at 15:08
  • Dear Fred One thing is not clear if **session_id()** sets the session id then why using **session_create_id()** ? Both sets the session id ? Or may be any difference between them ? – Stack Overflow Nov 25 '17 at 15:14