Var_dump (PHP)

Source: Internet
Author: User

Var_dump--Information about the print variable describes void Var_dump(mixed expression [, mixed expression [, ...]])

This function displays structure information about one or more expressions, including the type and value of the expression. The array recursively expands the value and displays its structure by indentation.

tip: to prevent the program from outputting the results directly to the browser, you can use the output control functions to capture the output of this function and save them to a variable such as a string type.

You can compare var_dump () with Print_r ().

Example 1. Var_dump () Example

<pre>
<?php
$a = array (1, 2, array ("a", "b", "c"));
var_dump ($a);

/* 输出:
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  array(3) {
    [0]=>
    string(1) "a"
    [1]=>
    string(1) "b"
    [2]=>
    string(1) "c"
  }
}

*/

$b = 3.1;
$c = TRUE;
var_dump($b,$c);

/* 输出:
float(3.1)
bool(true)

*/
?>
</pre>

Var_dump (PHP)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.