Revision: 48148
Updated Code
at June 27, 2011 19:43 by liamchapman
Updated Code
function debug_r($array=null,$dump=false,$string_type='serialize') { echo '<pre>'." "; if(is_array($array)) { if(count($array) > 0) { if($dump) { var_dump($array); }else{ print_r($array); } }else{ echo "Array empty"." "; } }else if(is_string($array)) { switch($string_type) { default: case 'serialize': $array = unserialize($array); break; case 'json': $array = json_decode($array); break; } if(count($array) > 0) { if($dump) { var_dump($array); }else{ print_r($array); } }else{ echo "Array empty"." "; } }else{ echo 'Invalid format'." "; } echo '</pre>'." "; }//end debug_r
Revision: 48147
Updated Code
at June 24, 2011 22:22 by liamchapman
Updated Code
function debug_r($array=null,$dump=false,$string_type='serialize') { echo '<pre>'." "; if(is_array($array)) { if(count($array) > 0) { if($dump) { var_dump($array); }else{ print_r($array); } }else{ echo "Array empty"." "; } }else if(is_string($array)) { switch($string_type) { default: case 'serialize': unserialize($array); break; case 'json': json_decode($array); break; } if(count($array) > 0) { if($dump) { var_dump($array); }else{ print_r($array); } }else{ echo "Array empty"." "; } }else{ echo 'Invalid format'." "; } echo '</pre>'." "; }//end debug_r
Revision: 48146
Updated Code
at June 24, 2011 22:21 by liamchapman
Updated Code
function debug_r($array=null,$dump=false,$string_type='serialize') { echo '<pre>'." "; if(is_array($array)) { if(count($array) > 0) { if($dump) { var_dump($array); }else{ print_r($array); } }else{ echo "Array empty"." "; } }else if(is_string($array)) { switch($string_type) { default: case 'serialize': unserialize($array); break; case 'json': json_decode($array); break; } if(count($array) > 0) { if($dump) { var_dump($array); }else{ print_r($array); } }else{ echo "Array empty"." "; } }else{ echo 'Invalid format'." "; } echo '</pre>'." "; }//end debug_r
Revision: 48145
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 24, 2011 22:21 by liamchapman
Initial Code
function debug_r($array=null,$dump=false,$string_type='serialize') { echo '<pre>'." "; if(is_array($array)) { if(count($array) > 0) { if($dump) { var_dump($array); }else{ print_r($array); } }else{ echo "Array empty"." "; } }else if(is_string($array)) { switch($string_type) { default: case 'serialize': unserialize($array); break; case 'json': json_decode($array); break; } if(count($array) > 0) { if($dump) { var_dump($array); }else{ print_r($array); } }else{ echo "Array empty"." "; } }else{ echo 'Invalid format'." "; } echo '</pre>'." "; }//end debug_r
Initial URL
Initial Description
a more useful way of printing php arrays in a nice readable format and able to decode serialized and json_encoded strings.
Initial Title
PHP Array Debug
Initial Tags
php, debug, array
Initial Language
PHP