Jump to content

Var dump(): Difference between revisions

From MorDictionary
MorMythos (talk | contribs)
Created page with "{{Unverified|This entry has not been fully reviewed against official documentation. Use with caution.}} ==var_dump()== ''func.'' [PHP 4, PHP 5, PHP 7, PHP 8] [vɑr dʌmp] ===Plain English=== <code>var_dump()</code> tells a program to reveal exactly what's inside something: a variable, a value, an array, an object, or the result of an expression. Not just the value, but what kind of thing it is and how much of it there is. Hand it the word <code>"pending"</code> and it..."
 
MorMythos (talk | contribs)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Unverified|This entry has not been fully reviewed against official documentation. Use with caution.}}
<div style="background:#3a2a00; border:1px solid #ffaa00; padding:8px 12px; color:#ffcc66;">
{{{1|This entry has not been fully reviewed. Use with caution.}}}
</div>


==var_dump()==
==var_dump()==
Line 18: Line 20:


===Example===
===Example===
"The form had been submitting for three days without saving anything. She finally dropped a
 
<code>var_dump($user)</code> at the top of the handler and found it immediately: <code>NULL</code>.
<code>$hot_women = ['Tinashe', 'Senait Gidey', 'Jisoo'];</code><br>
The object she had been passing around, calling methods on, treating as a fully formed thing,
<code>var_dump($hot_women);</code>
had never been instantiated. It was nothing. It had always been nothing."
 
Outputs:
 
<pre>
array(3) {
  [0]=> string(7) "Tinashe"
  [1]=> string(12) "Senait Gidey"
  [2]=> string(5) "Jisoo"
}
</pre>
 
Three items in the array. Each one identified by its position, its type, its length, and its value.
Nothing assumed. Nothing hidden.


===See also===
===See also===

Latest revision as of 01:16, 6 May 2026

⚠ This entry has not been fully reviewed. Use with caution.

var_dump()

[edit | edit source]

func. [PHP 4, PHP 5, PHP 7, PHP 8] [vɑr dʌmp]

Plain English

[edit | edit source]

var_dump() tells a program to reveal exactly what's inside something: a variable, a value, an array, an object, or the result of an expression. Not just the value, but what kind of thing it is and how much of it there is. Hand it the word "pending" and it shouts back: "I'm a string, I have seven letters, and the word is pending." Type, size, and value, all at once.

Definitions

[edit | edit source]
  1. (computing) A PHP debugging function that displays structured information about one or more expressions, including type and value. Accepts variables, literals, arrays, objects, or function results. Arrays and objects are explored recursively, with values indented to show structure. All public, private, and protected properties of objects are returned in the output unless the object implements a __debugInfo() method.

Syntax

[edit | edit source]

var_dump(mixed $value, mixed ...$values): void

  • Accepts one or more expressions to dump.
  • Returns no value.

Example

[edit | edit source]

$hot_women = ['Tinashe', 'Senait Gidey', 'Jisoo'];
var_dump($hot_women);

Outputs:

array(3) {
  [0]=> string(7) "Tinashe"
  [1]=> string(12) "Senait Gidey"
  [2]=> string(5) "Jisoo"
}

Three items in the array. Each one identified by its position, its type, its length, and its value. Nothing assumed. Nothing hidden.

See also

[edit | edit source]