print_r() is a handy function to print items in array to your screen. Its a great way to test and make sure your arrays have all the information they need. However its display can get quite messy if you have mulit-dimensional arrays. For example:

The output would look like this:

It shows all the information, however its bit difficult to see what is going on in there, all the arrays are lumped together. A better way of displaying the data would be to add some old school HTML tags such as the pre tags:
Now the out put looks like this:

This is alot easier to read as it stacks the arrays nicely. Finally you just chuck it into a handy function. I use this function to test data, check for errors and much more:

0 comments:
Post a Comment