Jul 11

Here’s a freebie since its friday. Print_r is a great debugging function, but it
doesn’t format well in a web browser. I’m sure 99.999% of php coders have this already,
but if not you’ll slap yourself in the forehead for not thinking of it sooner (I know
I did, you have no idea how long I coded before I thought about doing this…sad times).

The super-trick…wrap it in the pre tag. Common sense, yeah…

1
2
3
function print_mm($val)
{
  echo '
';
  print_r($val);
  echo '

‘;
}

On a side note, I’m thinking about putting up some full classes/objects in the not
to distant future. I just need to go through them and make sure there’s no “secret”
business logic in them first. Look for the first few around the beginning of August.


leave a reply

You must be logged in to post a comment.