var_dump() in php code example

Example 1: var_dump _post php

<?php print_r($_POST); ?>

Example 2: php var dump die

$variable = "hello";

var_dump($variable);
die();

Example 3: var_dump php

dumping objects that reference each other could lead to infinite recursion
<?php 
$brother = new Sibling();
$sister = new Sibling();
$brother->sister = $sister;
$sister->brother = $brother;

var_dump($brother); 
/* dumps all of $brother's properties, including "sister", which dumps all of $sister's properties, including "brother", etc. */
?>

Example 4: var dump php look clear

// make php var_dump print_r var_export look clear and pretty
echo '<pre>' . var_export($data, true) . '</pre>';
die('<pre>' . var_export($data, true) . '</pre>');

Example 5: php dump

$variable = "Hello";

var_dump($variable);

Tags:

Misc Example