Exercising the display functionality of the dump object

OB1

testClass (100)
lastTraceExecutionID92852824
lastTraceSerial100
one111
two
testClass (101)
lastTraceExecutionID92852824
lastTraceSerial101
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','fou…
5Hello World
612345
7123.45
1
Peter52
Sally45
GeoffreyNULL
ThisFilestream resource
2
0NULL
1Null string
2Empty array
3Hello World
two222
three
anotherTestClass (102)
lastTraceExecutionID92852824
lastTraceSerial102
one111
two222
three333
aHugeAmountOfStuffweDontWantFoo
four
anotherTestClass102
three333

OB1 (Now with block on anotherTestClass)

testClass (103)
lastTraceExecutionID7757618
lastTraceSerial103
one111
two
testClass (104)
lastTraceExecutionID7757618
lastTraceSerial104
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','fou…
5Hello World
612345
7123.45
1
Peter52
Sally45
GeoffreyNULL
ThisFilestream resource
2
0NULL
1Null string
2Empty array
3Hello World
two222
threeanotherTestClass …
fouranotherTestClass …
three333

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

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

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)
lastTraceExecutionID2012422
lastTraceSerial107
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
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','fou…
5Hello World
612345
7123.45
72808896
9918273645546372819099108
10102030stream resource5060708090100110120
11112233445566778899110121132
121224364860728496108120132144

Array of objects as table

testClass (108)lastTraceExecutionIDlastTraceSerialonethreetwo
Red9221191108111333
testClass (109)
lastTraceExecutionID9221191
lastTraceSerial109
oneArray(4) …
two222
threeanotherTestClass …
fouranotherTestClass …
anotherTestClass (110)aHugeAmountOfStuffweDontWantlastTraceExecutionIDlastTraceSerialonethreetwo
yellowFoo9221191110111333222
GreentestClass (109)
PinktestClass (108)
testClass (111)lastTraceExecutionIDlastTraceSerialonethreetwo
Blue9221191111111333
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)
lastTraceExecutionID16356995
lastTraceSerial112
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

Annoying array truncated to 5 elements ...

testClass (113)
lastTraceExecutionID23058006
lastTraceSerial113
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

... Annoying array/property hidden

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

SERVER (Strings limited to ten characters)

PATH/usr/local…
CONTENT_LENGTH0
HTTP_CONNECTIONclose
SCRIPT_NAME/misc/php/…
REQUEST_URI/misc/php/…
…Total 39 elements

SERVER (Strings limited to 1000 characters)

PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CONTENT_LENGTH0
HTTP_CONNECTIONclose
SCRIPT_NAME/misc/php/exercise_dump_display.php
REQUEST_URI/misc/php/exercise_dump_display.php
…Total 39 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