php

Print Arrays nicely using pr

I recently had to do some debugging of arrays. Print_r() is very, very ugly:
Array ( [0] => struct SidAndAttributesType { string SecurityIdentifier; unsignedInt Attributes; } [1] => struct NonEmptyArrayOfGroupIdentifiersType { SidAndAttributesType GroupIdentifier; } [2] => struct
I did some research and found a nice solution: use pr() instead of print_r.
Array
(
    [0] => struct SidAndAttributesType {
 string SecurityIdentifier;
 unsignedInt Attributes;
}
    [1] => struct NonEmptyArrayOfGroupIdentifiersType {
 SidAndAttributesType GroupIdentifier;
}
    [2] => struct NonEmptyArrayOfRestrictedGroupIdentifiersType {
 SidAndAttributesType RestrictedGroupIdentifier;
}
Shorter, simpler, sweeter!

Just wasted 20 minutes looking for whitespace...

I just wasted 20 minutes going through files looking for a white space that was causing "headers already sent" error message on login. I finally found it BEFORE the <? (i was looking at the ?> end).

Grrr....

Syndicate content