Home  >  Article  >  Backend Development  >  Do you really know how to use the var_dump method in php?

Do you really know how to use the var_dump method in php?

怪我咯
怪我咯Original
2017-07-06 10:05:321978browse

This article is a detailed analysis and introduction to the use of the var_dump method in php. Friends who need it can refer to it

First look at the example:

The code is as follows:

<?php
$a = "alsdflasdf;a";
$b = var_dump($a);
echo "<br>";
//var_dump($c);
$d=var_dump($c);
echo "<br>";
echo $a;
echo "<br>";
echo $b;
echo "<br>";

Output:
string(12) "alsdflasdf;a"
NULL
alsdflasdf;a

What does that mean? The var_dump() method is to determine the type and length of a variable, and output the value of the variable. If the variable has a value, the value of the variable is output and the data type is returned. This Function Displays structural information about one or more expressions , including the type and value of the expression. ArrayWill recursively expand the value, showing its structure through indentation.
Its format: var_dump ( mixed expression [, mixed expression [, ...]] )
Let’s take a look at var_dump syntax:
var_dump (var,var,bar);
It should be noted that the variables in var_dump must exist. If the variable exists but the value is empty, false will be returned; if there is no variable, NULL will be returned. Himself There is an output function. No need to add other output functions.

The above is the detailed content of Do you really know how to use the var_dump method in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn