var_dumpDUMPS information about a variable.
This function displays structured informations of STRINGS, NUMBERS, NULLS, BOOLEANS, ARRAYS, RESOURCES or OBJECTS.
ARRAYS and OBJECTS are explored recursively with values indented to show structure.
ARRAYS, RESOURCES and OBJECTS ...
... will be studied in more detail ...
... in a special chapter of this tutorial
<?php
void var_dump ( mix $expression [,
mix $arg1, ..., mix $argN ] )
where,
$expression = The expression to display the information
$arg1, ..., $argN = Other expressions to
display the information
?>
$expression
The expression to display the information .
$arg1, ... $argN
Other expressions to display the information.
EXERCISE
<?php
$ex01 = 'THIS IS A SIMPLE STRING EXAMPLE';
var_dump($ex01);
echo '<br><br>';
$ex02 = 1234567;
var_dump($ex02);
$ex03 = 1E19;
$ex04 = 1.6e-19;
echo '<br><br>';
var_dump($ex03, $ex04);
echo '<br><br>';
$ex05 = NULL;
var_dump($ex05);
echo '<br><br>';
$ex06 = TRUE;
$ex07 = true;
$ex08 = FALSE;
$ex09 = false;
var_dump($ex06, $ex07, $ex08, $ex09);
echo '<br><br>';
// INTERNAL
$ex10 = $_SERVER;
var_dump($ex10);
echo '<br><br>';
$ex11 = ["Countries", "Continents",
["Brasil", "Portugal", "Japan"],
["South America", "Europe", "Asia"] ];
var_dump($ex11);
?>
EXERCISE
<?php
$ex12 = ["Countries", "Continents",
["Brasil", "Portugal", "Japan"],
["South America", "Europe", "Asia"] ];
$ex13 = 123456;
$ex14 = TRUE;
$ex15 = 1E19;
echo '<pre>';
var_dump($ex12, $ex13, $ex14, $ex15);
echo '</pre>';
?>
EXERCISE
<?php
$ex16 = 'Non ducor duco';
$ex17 = 123456;
$ex18 = TRUE;
$ex19 = 1E19;
echo '<pre>';
var_dump($ex16, $ex17, $ex18, $ex19);
echo '</pre>';
?>
RESULT
string(14) "Non ducor duco"
int(123456)
bool(true)
float(1.0E+19)
EXERCISE
<?php
class test01
{
var $var01 = 'Alea jacta est';
var $var02 = 'Luck is on';
}
$obj01 = new test01;
echo '<pre>';
var_dump($obj01);
echo '</pre>';
/* - - - - - - - - - - - - - - - - - - - - - - - -
This exercise involves the use
of a CLASS and an OBJECT,
which will be studied shortly.
- - - - - - - - - - - - - - - - - - - - - - - - */
?>
RESULT
object(test01)#1 (2) {
["var01"]=>
string(14) "Alea jacta est"
["var02"]=>
string(10) "Luck is on"
}