Source of exercise_dump_display.php

<?php /**/ ?><?php
/*
  Exercise the dumpFunctions
*/
include('dump.php');

print(
'<h2>Exercising the display functionality of the dump object</h2>');

$integer 12345;
$real 123.45;
$string "Hello World";
$longString file_get_contents(__FILE__);
$resource fopen(__FILE__,'r');
$simpleArray = array(1,2,'three','four',$longString,$string,$integer,$real);
$keyedArray = array('Peter'=>52,'Sally'=>45,'Geoffrey'=>null,'ThisFile'=>$resource);
$arrayOfNulls = array(null,'',array());
$compoundArray = array($simpleArray,$keyedArray,$arrayOfNulls,$string);

class 
testClass extends dumpParent {
  var 
$one 111;
  var 
$two 222;
  var 
$three 333;
}
class 
anotherTestClass extends testClass {
  var 
$aHugeAmountOfStuffweDontWant 'Foo';
}
$ob1 = new testClass;
$ob2 = new testClass;
$ob3 = new anotherTestClass;
$ob1->two $ob2;
$ob2->one $compoundArray;
$ob2->three $ob3;
$ob2->four  $ob3;
print(
'<h3>OB1</h3>');
print(
dump::Value($ob1));
print(
'<h3>OB1 (Now with block on anotherTestClass)</h3>');
dump::IgnoreClasses('anotherTestClass');
print(
dump::Value($ob1));
print(
'<h3>OB1 (Now also with block on property "one")</h3>');
dump::IgnoreKeys('one');
print(
dump::Value($ob1));


print(
'<h3>Limiting array to first 4 items</h3>');
print(
dump::Value($simpleArray,4));

$maxa 15;
$a = array();
$a[0]='Hello world';
for(
$i=1;$i<$maxa;$i++){
  
$a[$i]= array(($maxa-$i)*100,$a[$i-1]);
}
print(
'<h3>Nested arrays : Max depth 7</h3>');
dump::SetMaximumDepth(7);
print(
dump::Value($a[$maxa-1]));

$ob4 = new testClass;
$ob4->two $a;


$timesTable=array();
for(
$i 1;$i<13;$i++){
  
$timesTable[$i]=array();
  for(
$j 1;$j<13;$j++){
    
$timesTable[$i][$j]= $i*$j ;
  }
}
$timesTable[1][4]= '' ;
$timesTable[2][8]= 'Hello World' ;
$timesTable[4][9]= $ob4 ;
$timesTable[6][2]= null ;
$timesTable[8][8]= $simpleArray ;
$timesTable[10][4]= $resource ;
dump::SetMaximumDepth(4);
print(
'<h3>Array of arrays as table</h3>');
print(
dump::Value($timesTable));
  
  
$objects = array();
$objects['Red']=$ob1;
$objects['yellow']=$ob3;
$objects['Green']=$ob2;
$objects['Pink']=$ob1;  // duplicate!
$objects['Blue']=$ob4;
print(
'<h3>Array of objects as table</h3>');
print(
dump::Value($objects));

print(
'<h3>Annoying array/property on show ...</h3>');
dump::SetMaximumDepth(7); 
print(
dump::Value($ob4));

print(
'<h3>Annoying array truncated to 5 elements ...</h3>');
dump::SetArrayLengthLimit(5); 
print(
dump::Value($ob4));

print(
'<h3>... Annoying array/property hidden</h3>');
dump::IgnoreKeys('two'); 
print(
dump::Value($ob4));

dump::Reset();
dump::SetMaximumDepth(3); 
$v get_defined_vars();
print(
'<h3>SERVER (Strings limited to ten characters)</h3>');

dump::SetMaximumStringLength(10);
print(
dump::Value($_SERVER));

print(
'<h3>SERVER (Strings limited to 1000 characters)</h3>');
dump::SetMaximumStringLength(1000);
print(
dump::Value($_SERVER));

dump::Help();

?>