<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Dumps information about a variable</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.unset.html">unset</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.var-export.html">var_export</a></div> <div class="up"><a href="ref.var.html">Variable handling Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.var-dump" class="refentry"> <div class="refnamediv"> <h1 class="refname">var_dump</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">var_dump</span> — <span class="dc-title">Dumps information about a variable</span></p> </div> <div class="refsect1 description" id="refsect1-function.var-dump-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>var_dump</strong></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$expression</code></span> [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$...</code></span> ] )</div> <p class="simpara"> This function displays structured information about one or more expressions that includes its type and value. Arrays and objects are explored recursively with values indented to show structure. </p> <p class="simpara"> In PHP 5 all public, private and protected properties of objects will be returned in the output. </p> <div class="tip"><strong class="tip">Tip</strong><p class="simpara">As with anything that outputs its result directly to the browser, the <a href="book.outcontrol.html" class="link">output-control functions</a> can be used to capture the output of this function, and save it in a <span class="type"><a href="language.types.string.html" class="type string">string</a></span> (for example).</p></div> </div> <div class="refsect1 parameters" id="refsect1-function.var-dump-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">expression</code></em></span> <dd> <p class="para"> The variable you want to dump. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.var-dump-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> <div class="refsect1 examples" id="refsect1-function.var-dump-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-5278"> <p><strong>Example #1 <span class="function"><strong>var_dump()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$a </span><span style="color: #007700">= array(</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, array(</span><span style="color: #DD0000">"a"</span><span style="color: #007700">, </span><span style="color: #DD0000">"b"</span><span style="color: #007700">, </span><span style="color: #DD0000">"c"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> array(3) { [0]=> int(1) [1]=> int(2) [2]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } } </pre></div> </div> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br />$b </span><span style="color: #007700">= </span><span style="color: #0000BB">3.1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$c </span><span style="color: #007700">= </span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$b</span><span style="color: #007700">, </span><span style="color: #0000BB">$c</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> float(3.1) bool(true) </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.var-dump-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.print-r.html" class="function" rel="rdfs-seeAlso">print_r()</a> - Prints human-readable information about a variable</span></li> <li class="member"> <span class="function"><a href="function.debug-zval-dump.html" class="function" rel="rdfs-seeAlso">debug_zval_dump()</a> - Dumps a string representation of an internal zend value to output</span></li> <li class="member"> <span class="function"><a href="function.var-export.html" class="function" rel="rdfs-seeAlso">var_export()</a> - Outputs or returns a parsable string representation of a variable</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.unset.html">unset</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.var-export.html">var_export</a></div> <div class="up"><a href="ref.var.html">Variable handling Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>