<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/language.constants.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'language.constants.magic.php',
    1 => 'Costanti magiche',
    2 => 'Costanti magiche',
  ),
  'up' => 
  array (
    0 => 'language.constants.php',
    1 => 'Costanti',
  ),
  'prev' => 
  array (
    0 => 'language.constants.predefined.php',
    1 => 'Costanti predefinite',
  ),
  'next' => 
  array (
    0 => 'language.expressions.php',
    1 => 'Expressions',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'language/constants.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="language.constants.magic" class="sect1">
   <h2 class="title">Costanti magiche</h2>
   <p class="para">
    Ci sono nove costanti magiche che cambiano in base a
    dove vengono utilizzate.  Per esempio, il valore di
    <strong><code><a href="language.constants.magic.php#constant.line">__LINE__</a></code></strong> dipende dalla linea che sta
    utilizzando nel tuo script. Tutte queste costanti &quot;magiche&quot; vengono risolte
    in fase di compilazione, a differenza delle costanti regolari, che vengono risolte in fase di esecuzione.
    Queste costanti speciali non fanno distinzione tra maiuscole e minuscole e sono le seguenti:
   </p>
   <p class="para">
    <table class="doctable table">
     <caption><strong>Costanti magiche di PHP</strong></caption>
     
      <thead>
       <tr>
        <th>Nome</th>
        <th>Descrizione</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr id="constant.line">
        <td><strong><code><a href="language.constants.magic.php#constant.line">__LINE__</a></code></strong></td>
        <td>
         Il numero della riga corrente del file.
        </td>
       </tr>

       <tr id="constant.file">
        <td><strong><code><a href="language.constants.magic.php#constant.file">__FILE__</a></code></strong></td>
        <td>
         Il percorso completo e il nome del file con i link simbolici risolti. Se utilizzato all&#039;interno di un&#039;inclusione,
         viene restituito il nome del file incluso.
        </td>
       </tr>

       <tr id="constant.dir">
        <td><strong><code><a href="language.constants.magic.php#constant.dir">__DIR__</a></code></strong></td>
        <td>
         La cartella del file.  Se utilizzato all&#039;interno di un&#039;inclusione,
         viene restituita la cartella del file incluso. Questo è equivalente
         a <code class="literal">dirname(__FILE__)</code>. Il nome della cartella
         non ha slash a meno che non sia la directory root.
        </td>
       </tr>

       <tr id="constant.function">
        <td><strong><code><a href="language.constants.magic.php#constant.function">__FUNCTION__</a></code></strong></td>
        <td>
         Il nome della funzione, o <code class="literal">{closure}</code> per le funzioni anonime.
        </td>
       </tr>

       <tr id="constant.class">
        <td><strong><code><a href="language.constants.magic.php#constant.class">__CLASS__</a></code></strong></td>
        <td>
         Il nome della classe. Il nome della classe include il namespace
         in cui è stata dichiarata (es. <code class="literal">Foo\Bar</code>).
         Quando usata
         in un metodo trait, __CLASS__ è il nome della classe in cui il trait
         è usato.
        </td>
       </tr>

       <tr id="constant.trait">
        <td><strong><code><a href="language.constants.magic.php#constant.trait">__TRAIT__</a></code></strong></td>
        <td>
         Il nome del trait. Il nome del trait include il namespace
         in cui è stato dichiarato (es. <code class="literal">Foo\Bar</code>).
        </td>
       </tr>

       <tr id="constant.method">
        <td><strong><code><a href="language.constants.magic.php#constant.method">__METHOD__</a></code></strong></td>
        <td>
         Il nome del metodo della classe. 
        </td>
       </tr>

       <tr id="constant.namespace">
        <td><strong><code><a href="language.constants.magic.php#constant.namespace">__NAMESPACE__</a></code></strong></td>
        <td>
         Il nome del namespace corrente.
        </td>
       </tr>

       <tr id="constant.coloncolonclass">
        <td><strong><code><span class="replaceable">ClassName</span>::class</code></strong></td>
        <td>
         Il nome completo della classe.
        </td>
       </tr>

      </tbody>
     
    </table>

   </p>

   <div class="sect2">
    <h3 class="title">Vedere anche:</h3>
    <p class="para">
     <ul class="simplelist">
      <li><a href="language.oop5.basic.php#language.oop5.basic.class.class" class="link">::class</a></li>
      <li><span class="function"><a href="function.get-class.php" class="function">get_class()</a></span></li>
      <li><span class="function"><a href="function.get-object-vars.php" class="function">get_object_vars()</a></span></li>
      <li><span class="function"><a href="function.file-exists.php" class="function">file_exists()</a></span></li>
      <li><span class="function"><a href="function.function-exists.php" class="function">function_exists()</a></span></li>
     </ul>
    </p>
   </div>

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