<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.splfixedarray.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'splfixedarray.setsize.php',
    1 => 'SplFixedArray::setSize',
    2 => 'Change the size of an array',
  ),
  'up' => 
  array (
    0 => 'class.splfixedarray.php',
    1 => 'SplFixedArray',
  ),
  'prev' => 
  array (
    0 => 'splfixedarray.serialize.php',
    1 => 'SplFixedArray::__serialize',
  ),
  'next' => 
  array (
    0 => 'splfixedarray.toarray.php',
    1 => 'SplFixedArray::toArray',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/spl/splfixedarray/setsize.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="splfixedarray.setsize" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SplFixedArray::setSize</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">SplFixedArray::setSize</span> &mdash; <span class="dc-title">Change the size of an array</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-splfixedarray.setsize-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>SplFixedArray::setSize</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$size</code></span>): <span class="type"><a href="language.types.singleton.php" class="type true">true</a></span></div>

  <p class="para rdfs-comment">
   Change the size of an array to the new size of <code class="parameter">size</code>. If 
   <code class="parameter">size</code> is less than the current array size, any values after the new size 
   will be discarded. If <code class="parameter">size</code> is greater than the current array size, the 
   array will be padded with <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> values.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-splfixedarray.setsize-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">size</code></dt>
     <dd>
      <p class="para">
       The new array size. This should be a value between <code class="literal">0</code> and <strong><code><a href="reserved.constants.php#constant.php-int-max">PHP_INT_MAX</a></code></strong>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-splfixedarray.setsize-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="simpara">
   Gibt immer <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurück.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-splfixedarray.setsize-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <p class="simpara">
   Throws <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span> when
   <code class="parameter">size</code> is less than zero.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-splfixedarray.setsize-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Beschreibung</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.4.0</td>
      <td>
       <span class="methodname"><strong>SplFixedArray::setSize()</strong></span>
       now has a tentative return of <span class="type"><a href="language.types.singleton.php" class="type true">true</a></span>.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-splfixedarray.setsize-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>SplFixedArray::setSize()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />   $array </span><span style="color: #007700">= new </span><span style="color: #0000BB">SplFixedArray</span><span style="color: #007700">(</span><span style="color: #0000BB">5</span><span style="color: #007700">);<br />   echo </span><span style="color: #0000BB">$array</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getSize</span><span style="color: #007700">().</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />   </span><span style="color: #0000BB">$array</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setSize</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">);<br />   echo </span><span style="color: #0000BB">$array</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getSize</span><span style="color: #007700">().</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">5
10</pre>
</div>
    </div>
   </div>
  </p>
 </div>

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