PHP var_dump function

 PHP var_dump function function is used to print variable associated message on the screen, for example, variable values, or of variable type, based on ships var_dump string variables and array variables , use is very simple, just to be printed Just fill in the var_dump function, and the function will output the result directly without return value.


Basic syntax of PHP var_dump function
void var_dump (mixed $expression [, mixed $...])
The $expression in var_dump syntax is the variable to be displayed. It is required. Fill in at least one variable at a time. If you fill in multiple variables, the var_dump function can still output the value and type of the variable smoothly.

PHP var_dump function example
<?php
 $EX_A = array(8,9,array('apple','orange'));
 $EX_B = 6.8;
 var_dump($EX_A,$EX_B);
?>
Sample output

In order to show the var_dump function to process multiple variables at once , we prepared two variables from the beginning , namely the $EX_A array and the $EX_B floating-point number, so the output of the example looks a bit complicated. You can combine these two It will be simpler to write each variable separately. From the first output result of the example, we can see that the var_dump function correctly judges the array type and displays the contents of the two-array array. The second output also correctly judges that the variable is a floating-point number, and To output the value of a floating point number, this is the standard usage of the var_dump function.

Post a Comment

0 Comments