Exercising the display functionality of the dump object

OB1

testClass (100)
one111
two
testClass (101)
one
0
01
12
2three
3four
4<?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);¶
$keye…
5Hello World
612345
7123.45
1
Peter52
Sally45
GeoffreyNULL
ThisFilestream resource
2
0NULL
1Null string
2Empty array
3Hello World
two222
three
anotherTestClass (102)
aHugeAmountOfStuffweDontWantFoo
one111
two222
three333
lastTraceExecutionID74420218
lastTraceSerial102
lastTraceExecutionID74420218
lastTraceSerial101
four
anotherTestClass102
three333
lastTraceExecutionID74420218
lastTraceSerial100

OB1 (Now with block on anotherTestClass)

testClass (103)
one111
two
testClass (104)
one
0
01
12
2three
3four
4<?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);¶
$keye…
5Hello World
612345
7123.45
1
Peter52
Sally45
GeoffreyNULL
ThisFilestream resource
2
0NULL
1Null string
2Empty array
3Hello World
two222
threeanotherTestClass …
lastTraceExecutionID54984564
lastTraceSerial104
fouranotherTestClass …
three333
lastTraceExecutionID54984564
lastTraceSerial103

OB1 (Now also with block on property "one")

testClass (105)
one111
two
testClass (106)
oneArray(4) …
two222
threeanotherTestClass …
lastTraceExecutionID62301830
lastTraceSerial106
fouranotherTestClass …
three333
lastTraceExecutionID62301830
lastTraceSerial105

Limiting array to first 4 items

01
12
2three
3four
…Total 8 elements

Nested arrays : Max depth 7

0100
1
0200
1
0300
1
0400
1
0500
1
0600
1
0700
1Array(2) …

Array of arrays as table

123456789101112
1123Null string56789101112
22468101214Hello World18202224
3369121518212427303336
448121620242832
testClass (107)
one111
two
0Hello world
1Array(2) …
2Array(2) …
3Array(2) …
4Array(2) …
5Array(2) …
6Array(2) …
7Array(2) …
8Array(2) …
9Array(2) …
10Array(2) …
11Array(2) …
12Array(2) …
13Array(2) …
14Array(2) …
three333
lastTraceExecutionID85773633
lastTraceSerial107
404448
551015202530354045505560
66NULL18243036424854606672
771421283542495663707784
88162432404856
01
12
2three
3four
4<?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);¶
$keye…
5Hello World
612345
7123.45
72808896
9918273645546372819099108
10102030stream resource5060708090100110120
11112233445566778899110121132
121224364860728496108120132144

Array of objects as table

testClass (108)lastTraceExecutionIDlastTraceSerialonethreetwo
Red26966924108111333
testClass (109)
oneArray(4) …
two222
threeanotherTestClass …
lastTraceExecutionID26966924
lastTraceSerial109
fouranotherTestClass …
anotherTestClass (110)aHugeAmountOfStuffweDontWantlastTraceExecutionIDlastTraceSerialonethreetwo
yellowFoo26966924110111333222
GreentestClass (109)
PinktestClass (108)
testClass (111)lastTraceExecutionIDlastTraceSerialonethreetwo
Blue26966924111111333
0Hello world
1
01400
1Hello world
2
01300
1
01400
1Hello world
3
01200
1
01300
1
01400
1Hello world
4
01100
1
01200
1
01300
1Array(2) …
5
01000
1
01100
1
01200
1Array(2) …
6
0900
1
01000
1
01100
1Array(2) …
7
0800
1
0900
1
01000
1Array(2) …
8
0700
1
0800
1
0900
1Array(2) …
9
0600
1
0700
1
0800
1Array(2) …
10
0500
1
0600
1
0700
1Array(2) …
11
0400
1
0500
1
0600
1Array(2) …
12
0300
1
0400
1
0500
1Array(2) …
13
0200
1
0300
1
0400
1Array(2) …
14
0100
1
0200
1
0300
1Array(2) …

Annoying array/property on show ...

testClass (112)
one111
two
0Hello world
1
01400
1Hello world
2
01300
1
01400
1Hello world
3
01200
1
01300
1
01400
1Hello world
4
01100
1
01200
1
01300
1
01400
1Hello world
5
01000
1
01100
1
01200
1
01300
1Array(2) …
6
0900
1
01000
1
01100
1
01200
1Array(2) …
7
0800
1
0900
1
01000
1
01100
1Array(2) …
8
0700
1
0800
1
0900
1
01000
1Array(2) …
9
0600
1
0700
1
0800
1
0900
1Array(2) …
10
0500
1
0600
1
0700
1
0800
1Array(2) …
11
0400
1
0500
1
0600
1
0700
1Array(2) …
12
0300
1
0400
1
0500
1
0600
1Array(2) …
13
0200
1
0300
1
0400
1
0500
1Array(2) …
14
0100
1
0200
1
0300
1
0400
1Array(2) …
three333
lastTraceExecutionID38944569
lastTraceSerial112

Annoying array truncated to 5 elements ...

testClass (113)
one111
two
0Hello world
1
01400
1Hello world
2
01300
1
01400
1Hello world
3
01200
1
01300
1
01400
1Hello world
4
01100
1
01200
1
01300
1
01400
1Hello world
…Total 15 elements
three333
lastTraceExecutionID59087651
lastTraceSerial113

... Annoying array/property hidden

testClass (114)
one111
twoArray(15) …
three333
lastTraceExecutionID14444600
lastTraceSerial114

SERVER (Strings limited to ten characters)

PATH/bin:/usr/…
RAILS_ENVproduction
HTTP_CONNECTIONclose
SCRIPT_NAME/misc/php/…
REQUEST_URI/misc/php/…
…Total 33 elements

SERVER (Strings limited to 1000 characters)

PATH/bin:/usr/bin:/sbin:/usr/sbin
RAILS_ENVproduction
HTTP_CONNECTIONclose
SCRIPT_NAME/misc/php/exercise_dump_display.php
REQUEST_URI/misc/php/exercise_dump_display.php
…Total 33 elements
Setup
  • include('dump.php') Put dump.php in your include path
Print values immediately
  • print(dump::Value($myValue))
  • print(dump::Value($myArray,5)) Only first 5 elements of array displayed. (See also SetArrayLengthLimit())
Trace
  • dump::Trace($myValue)
  • dump::Trace($myValue,'some comment')
  • dump::Trace($myValue,'some comment',$aBoolean) Conditional on 3rd argument
  • dump::Trace('STACK') Shows the stack and args used. See also SetStackArgumentDetail()
  • dump::Clear() Empties trace buffer but does not call Reset() (Output() normally clears automatically).
Dump
  • dump::Output() Prints trace buffer on screen (and clears the buffer)
  • dump::Output('someQuickFile.htm') Prints trace buffer to file (and clears the buffer)
  • dump::Output('someQuickFile.htm',false) Prints trace buffer to file (without clearing the buffer)
Tweaks
  • dump::Reset() Reset defaults. (Does not clear trace buffer - see Clear() )
  • dump::IgnoreClasses('tooBigClass,dontCareClass,etcClass') Names of classes that are supressed. Split by commas.
  • dump::IgnoreKeys('thisProperty,thatProperty,foo') Names of properties and array keys that are supressed. Split by commas.
  • dump::SetMaximumDepth($howDeep) How far should arrays and object properties be investigated (1 to 30 default 20)
  • dump::SetMaximumStringLength($charsWide) How much of strings to show before truncating them
  • dump::SetStackArgumentDetail(2) Amount of detail to show in stack trace (1 is least, 2 is default)
  • dump::SetArrayLengthLimit(14) Max number of array elements to show in general. Might use before tracing stack to limit expansion of function arguments.
  • dump::Help()
About © 2009 Peter Fox http://vulpeculox.net
This version dated 11th Feb 2015