You are here: Re: print_r with perline (nice) formatting for arrays - How? « PHP Language « IT news, forums, messages
Re: print_r with perline (nice) formatting for arrays - How?

Posted by Joe Scylla on 05/24/07 15:42

cluthz wrote:
> I've lived with print_r printing my array variable output on a single
> wrapped line for some time now.
>
> But I now want to know how to make print_r print an array on multiple lines
> making it easier to read.
>
> I have tried to google this but difficult to know what keywords to use and
> thus have not found good results.
>
> Does anyone know how I can do this?
>
> Thanks in advance.
>
>

i'm using that function for printing out variables, arrays or objects.
hope that helps.

/**
* Dumps the values of an variable, array or object.
*
* @param mixed $v
* @return void
*/
function dump($v)
{
echo "\n<pre>\n" . "- dump " . str_repeat("-", 79 - strlen("- dump "))
.. "\n";
if(is_array($v))
{
print_r($v);
}
elseif (is_object($v))
{
print_r($v);
}
else
{
var_dump($v);
}
echo str_repeat("-", 79) . "\n</pre>\n";
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация