Printing an array, string or anything else…

This post is carrying on the theme of sharing little bits of code (like my good friend @boxedfish did the other day) – How to easily split a sequence of number into a hython seperate string

This is not the greatest bit of code I have ever written and its not going to knock you over with complexity but what it will do is save your little fingers and over a year give you back quite a large chunk of time.
[php]

function output($my_array, $my_die = 0)
{
echo ‘<hr />’;
echo ‘<pre>’;
print_r($my_array);
echo ‘</pre>’;
echo ‘<hr />’;

if ($my_die == 1) { die(); }
}

[/php]

Then all you have to do is

[php]
output($my_string);
output($my_array);
[/php]

Leave a Reply

Your email address will not be published. Required fields are marked *