php dump variable code example

Example 1: php var dump die

$variable = "hello";

var_dump($variable);
die();

Example 2: 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 3: php dump

$variable = "Hello";

var_dump($variable);

Example 4: php dump to page

$variable = "Hello";

var_dump($variable);

Tags:

Php Example