Source for file example-2.php
Documentation is available at example-2.php
include_once 'Var_Dump.php';
echo '<h1>example2.php : singleton approach</h1>';
* example2.php : Singleton approach
* Var_Dump::display() uses a singleton pattern, so if you want to
* use this method, and configure the output to your needs, you will have
* to call before the singleton constructor with the appropriate parameters.
* (for instance in the auto_prepend file)
// Initialise the HTML4 Table rendering (see Var_Dump/Renderer/HTML4_Table.php)
$obj = & Var_Dump ::singleton (
'display_mode' => 'HTML4_Table'
'bordercolor' => '#DDDDDD',
'captioncolor' => 'white',
'before_num_key' => '<font color="#CC5450"><b>',
'after_num_key' => '</b></font>',
'before_str_key' => '<font color="#5450CC">',
'after_str_key' => '</font>',
$linkedArray=array ('john', 'jack', 'bill');
'key-1' => 'This is an example of string',
'key-3-2' => & $linkedArray,
Var_Dump ::display ($array);
* Displays an object (with recursion)
echo '<h2>Object (Recursive)</h2>';
$this->myChild = new child ($this);
$this->myName = 'parent';
function child (&$parent) {
$this->myParent = & $parent;
$recursiveObject=new parent ();
Var_Dump ::display ($recursiveObject);
* Displays a classic object
echo '<h2>Object (Classic)</h2>';
Var_Dump ::display ($object);
Documentation generated on Mon, 11 Mar 2019 10:16:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|