Oct 28, 2011
James Mills

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.


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

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

Then all you have to do is

output($my_string);
output($my_array);

Leave a comment

Categories

What I'm Doing...

  • Think I just cracked the calendar day view for the system I am working on! Woop! Time to head home to the wife! 1 hr ago
  • Lights just gone out in the office and I nearly broke my neck trying to walk over to the sensor at the other side of the room! Grrr! 2 hrs ago
  • @paulsheperia good rant Paul, its been a while! 4 hrs ago
  • More updates...