[追記]var_dump() 前提で回答してましたが違うようですね^^;失礼。 マニュアルの User Contributed Notes の print_r_reverse() を少し加工することでイケそうです。
php
1<?php2classTest3{4public$a=[5[6"b"=>5,7"c"=>100,8],9];10public$d=0;11public$e=1;12}13$test=newTest;14$tmp=print_r($test,true);15print_r(print_r_reverse($tmp));161718functionprint_r_reverse($input){19$lines=preg_split('#\r?\n#',trim($input));20if(trim($lines[0])!='Array'&&trim($lines[0]!='Test Object')){21// bottomed out to something that isn't an array or object22if($input===''){23returnnull;24}2526return$input;27}else{28// this is an array or object, lets parse it29$match=array();30if(preg_match("/(\s{5,})(/",$lines[1],$match)){31// this is a tested array/recursive call to this function32// take a set of spaces off the beginning33$spaces=$match[1];34$spaces_length=strlen($spaces);35$lines_total=count($lines);36for($i=0;$i<$lines_total;$i++){37if(substr($lines[$i],0,$spaces_length)==$spaces){38$lines[$i]=substr($lines[$i],$spaces_length);39}40}41}42$is_object=trim($lines[0])=='stdClass Object';43array_shift($lines);// Array44array_shift($lines);// (45array_pop($lines);// )46$input=implode("\n",$lines);47$matches=array();48// make sure we only match stuff with 4 preceding spaces (stuff for this array and not a nested one)49preg_match_all("/^\s{4}[(.+?)] \=\> /m",$input,$matches,PREG_OFFSET_CAPTURE|PREG_SET_ORDER);50$pos=array();51$previous_key='';52$in_length=strlen($input);53// store the following in $pos:54// array with key = key of the parsed array's item55// value = array(start position in $in, $end position in $in)56foreach($matchesas$match){57$key=$match[1][0];58$start=$match[0][1]+strlen($match[0][0]);59$pos[$key]=array($start,$in_length);60if($previous_key!=''){61$pos[$previous_key][1]=$match[0][1]-1;62}63$previous_key=$key;64}65$ret=array();66foreach($posas$key=>$where){67// recursively see if the parsed out value is an array too68$ret[$key]=print_r_reverse(substr($input,$where[0],$where[1]-$where[0]));69}7071return$is_object?(object)$ret:$ret;72}73}74?>