<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.phar.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'phar.getstub.php',
    1 => 'Phar::getStub',
    2 => 'Return the PHP loader or bootstrap stub of a Phar archive',
  ),
  'up' => 
  array (
    0 => 'class.phar.php',
    1 => 'Phar',
  ),
  'prev' => 
  array (
    0 => 'phar.getsignature.php',
    1 => 'Phar::getSignature',
  ),
  'next' => 
  array (
    0 => 'phar.getsupportedcompression.php',
    1 => 'Phar::getSupportedCompression',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/phar/Phar/getStub.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="phar.getstub" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Phar::getStub</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL phar &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Phar::getStub</span> &mdash; <span class="dc-title">Return the PHP loader or bootstrap stub of a Phar archive</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-phar.getstub-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Phar::getStub</strong></span>(): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>


  <p class="para rdfs-comment">
   Phar archives contain a bootstrap loader, or <code class="literal">stub</code>
   written in PHP that is executed when the archive is executed in PHP either via
   include:
   <div class="example-contents">
    <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">include </span><span style="color: #DD0000">'myphar.phar'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   or by simple execution:
   <div class="example-contents screen">
    <div class="descriptioncode"><pre class="descriptioncode">php myphar.phar</pre>
</div>
   </div>
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-phar.getstub-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">Questa funzione non contiene parametri.</p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-phar.getstub-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Returns a string containing the contents of the bootstrap loader (stub) of
   the current Phar archive.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-phar.getstub-errors">
  <h3 class="title">Errori/Eccezioni</h3>
  <p class="para">
   Throws <span class="classname"><a href="class.runtimeexception.php" class="classname">RuntimeException</a></span> if it is not possible to read
   the stub from the Phar archive.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-phar.getstub-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 A <span class="function"><strong>Phar::getStub()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$p </span><span style="color: #007700">= new </span><span style="color: #0000BB">Phar</span><span style="color: #007700">(</span><span style="color: #DD0000">'/path/to/my.phar'</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #DD0000">'my.phar'</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getStub</span><span style="color: #007700">();<br />echo </span><span style="color: #DD0000">"==NEXT==\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setStub</span><span style="color: #007700">(</span><span style="color: #DD0000">"&lt;?php<br />function __autoload(</span><span style="color: #0000BB">$class</span><span style="color: #DD0000">)<br />{<br />    include 'phar://' . str_replace('_', '/', </span><span style="color: #0000BB">$class</span><span style="color: #DD0000">);<br />}<br />Phar::mapPhar('myphar.phar');<br />include 'phar://myphar.phar/startup.php';<br />__HALT_COMPILER(); ?&gt;"</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getStub</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Il precedente esempio visualizzerà:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">&lt;?php __HALT_COMPILER(); ?&gt;
==NEXT==
&lt;?php
function __autoload($class)
{
    include &#039;phar://&#039; . str_replace(&#039;_&#039;, &#039;/&#039;, $class);
}
Phar::mapPhar(&#039;myphar.phar&#039;);
include &#039;phar://myphar.phar/startup.php&#039;;
__HALT_COMPILER(); ?&gt;</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-phar.getstub-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="phar.setstub.php" class="function" rel="rdfs-seeAlso">Phar::setStub()</a> - Used to set the PHP loader or bootstrap stub of a Phar archive</span></li>
    <li><span class="function"><a href="phar.createdefaultstub.php" class="function" rel="rdfs-seeAlso">Phar::createDefaultStub()</a> - Create a phar-file format specific stub</span></li>
   </ul>
  </p>
 </div>



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