<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.var.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.debug-zval-dump.php',
    1 => 'debug_zval_dump',
    2 => 'Dumps a string representation of an internal zval structure to output',
  ),
  'up' => 
  array (
    0 => 'ref.var.php',
    1 => 'Variable handling Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.boolval.php',
    1 => 'boolval',
  ),
  'next' => 
  array (
    0 => 'function.doubleval.php',
    1 => 'doubleval',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/var/functions/debug-zval-dump.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.debug-zval-dump" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">debug_zval_dump</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">debug_zval_dump</span> &mdash; <span class="dc-title">Dumps a string representation of an internal zval structure to output</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.debug-zval-dump-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>debug_zval_dump</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">...$values</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="para rdfs-comment">
   Dumps a string representation of an internal zval (Zend value) structure to output.
   This is mostly useful for understanding or debugging implementation details of the
   Zend Engine or PHP extensions.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.debug-zval-dump-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       The variable or value to dump.
      </p>
     </dd>
    
    
     <dt><code class="parameter">values</code></dt>
     <dd>
      <p class="para">
       Further variables or values to dump.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.debug-zval-dump-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Nessun valore viene restituito.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.debug-zval-dump-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>debug_zval_dump()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$var1 </span><span style="color: #007700">= </span><span style="color: #DD0000">'Hello'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$var1 </span><span style="color: #007700">.= </span><span style="color: #DD0000">' World'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$var2 </span><span style="color: #007700">= </span><span style="color: #0000BB">$var1</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">debug_zval_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$var1</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="annotation-interactive examplescode"><pre class="examplescode">string(11) &quot;Hello World&quot; refcount(3)</pre>
</div>
    </div>
   </div>
  </p>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <strong>Understanding the <code class="literal">refcount</code></strong><br />
   <p class="para">
    The <code class="literal">refcount</code> value shown by this function may be
    surprising without a detailed understanding of the engine&#039;s implementation.
   </p>
   <p class="para">
    The Zend Engine uses reference counting for two different purposes:
   </p>
   <p class="para">
    <ul class="simplelist">
     <li>
      Optimizing memory usage using a technique called "copy on write",
      where multiple variables holding the same value point to the same copy
      in memory. When any of the variables is modified, it is pointed to a new
      copy in memory, and the reference count on the original is decreased by 1.
     </li>
     <li>
      Tracking variables which have been assigned or passed by reference (see
      <a href="language.references.php" class="link">References Explained</a>). This
      refcount is stored on a separate reference zval, pointing to the zval
      for the current value. This additional zval is not currently shown by
      <span class="function"><strong>debug_zval_dump()</strong></span>.
     </li>
    </ul>
   </p>
   <p class="para">
    Because <span class="function"><strong>debug_zval_dump()</strong></span> takes its input as normal
    parameters, passed by value, the copy on write technique will be used
    to pass them: rather than copying the data, the refcount will be increased
    by one for the lifetime of the function call. If the function modified the
    parameter after receiving it, then a copy would be made; since it does not,
    it will show a refcount one higher than in the calling scope.
   </p>
   <p class="para">
    The parameter passing also prevents <span class="function"><strong>debug_zval_dump()</strong></span>
    showing variables which have been assigned by reference. To illustrate,
    consider a slightly modified version of the above example:

    <div class="informalexample">
     <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$var1 </span><span style="color: #007700">= </span><span style="color: #DD0000">'Hello'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$var1 </span><span style="color: #007700">.= </span><span style="color: #DD0000">' World'</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">// Point three variables as references to the same value<br /></span><span style="color: #0000BB">$var2 </span><span style="color: #007700">=&amp; </span><span style="color: #0000BB">$var1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$var3 </span><span style="color: #007700">=&amp; </span><span style="color: #0000BB">$var1</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">debug_zval_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$var1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

     <p class="para">Il precedente esempio visualizzerà:</p>
     <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">string(11) &quot;Hello World&quot; refcount(2)</pre>
</div>
     </div>
    </div>
   </p>
   <p class="para">
    Although <var class="varname">$var1</var>, <var class="varname">$var2</var>, and
    <var class="varname">$var3</var> are linked as references, only the
    <em>value</em> is passed to <span class="function"><strong>debug_zval_dump()</strong></span>.
    That value is used once by the set of references, and once inside the
    <span class="function"><strong>debug_zval_dump()</strong></span>, so shows a refcount of 2.
   </p>
   <p class="para">
    Further complications arise because of optimisations made in the engine for
    different data types. Some types such as integers do not use &quot;copy on write&quot;,
    so do not show a refcount at all. In other cases, the refcount shows extra
    copies used internally, such as when a literal string or array is stored as
    part of a code instruction.
   </p>
  </p></blockquote>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.debug-zval-dump-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.var-dump.php" class="function" rel="rdfs-seeAlso">var_dump()</a> - Stampa delle informazioni relative ad una variabile</span></li>
    <li><span class="function"><a href="function.debug-backtrace.php" class="function" rel="rdfs-seeAlso">debug_backtrace()</a> - Genera un backtrace</span></li>
    <li><a href="language.references.php" class="link">References Explained</a></li>
    <li><a href="http://derickrethans.nl/php_references_article.php" class="link external">&raquo;&nbsp;References Explained (by Derick Rethans)</a></li>
   </ul>
  </p>
 </div>

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