<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.session.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.session-id.php',
    1 => 'session_id',
    2 => 'Get and/or set the current session id',
  ),
  'up' => 
  array (
    0 => 'ref.session.php',
    1 => 'Session Функції',
  ),
  'prev' => 
  array (
    0 => 'function.session-get-cookie-params.php',
    1 => 'session_get_cookie_params',
  ),
  'next' => 
  array (
    0 => 'function.session-module-name.php',
    1 => 'session_module_name',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/session/functions/session-id.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.session-id" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">session_id</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">session_id</span> &mdash; <span class="dc-title">Get and/or set the current session id</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.session-id-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>session_id</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$id</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>session_id()</strong></span> is used to get or set the session id for
   the current session.
  </p>
  <p class="para">
   The constant <strong><code><a href="session.constants.php#constant.sid">SID</a></code></strong> can also be used to
   retrieve the current name and session id as a string suitable for
   adding to URLs. See also <a href="ref.session.php" class="link">Session
   handling</a>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.session-id-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">id</code></dt>
      <dd>
       <p class="para">
        If <code class="parameter">id</code> is specified and not <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, it will replace the current
        session id. <span class="function"><strong>session_id()</strong></span> needs to be called before
        <span class="function"><a href="function.session-start.php" class="function">session_start()</a></span> for that purpose. Depending on the
        session handler, not all characters are allowed within the session id.
        For example, the file session handler only allows characters in the
        range <code class="literal">[a-zA-Z0-9,-]</code>!
       </p>
       <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
        <span class="simpara">
         When using session cookies, specifying an <code class="parameter">id</code>
         for <span class="function"><strong>session_id()</strong></span> will always send a new cookie
         when <span class="function"><a href="function.session-start.php" class="function">session_start()</a></span> is called, regardless if the
         current session id is identical to the one being set.
        </span>
       </p></blockquote>
      </dd>
     
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.session-id-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   <span class="function"><strong>session_id()</strong></span> returns the session id for the current
   session or the empty string (<code class="literal">&quot;&quot;</code>) if there is no current
   session (no current session id exists).
   On failure, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> is returned.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.session-id-changelog">
  <h3 class="title">Журнал змін</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версія</th>
      <th>Опис</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">id</code> is nullable now.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.session-id-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.session-regenerate-id.php" class="function" rel="rdfs-seeAlso">session_regenerate_id()</a> - Update the current session id with a newly generated one</span></li>
    <li><span class="function"><a href="function.session-start.php" class="function" rel="rdfs-seeAlso">session_start()</a> - Start new or resume existing session</span></li>
    <li><span class="function"><a href="function.session-set-save-handler.php" class="function" rel="rdfs-seeAlso">session_set_save_handler()</a> - Sets user-level session storage functions</span></li>
    <li>
     <a href="session.configuration.php#ini.session.save-handler" class="link">session.save_handler</a>
    </li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>