* Thus wrote Donald Tyler ([EMAIL PROTECTED]):
> 
> Also, print_r() does not include any HTML formatting, so you will need to
> look at the source for the page in the browser to make it readable.

This is a problem I run into all the time, I am curious of how many
people have run into this.  I've been considering writting a patch
for php that will enable an option to htmlentity the strings. The
alternative would be to write a function that loops through all the
results:

function my_print_r($var) {
  $r = print_r($var, true);
  foreach($var as $key => $val) {
    if (is_string($val) ) {
      $val = htmlentities($val);
    } elseif (is_array($val) {
      $val = my_print_r($val);
    }
    $r[$key] = $val;
  }
  return $r;
}

Since print_r is usually used for debugging, it would be nice that
php does this for you.  Any comments on this before i throw the
idea to the php-dev list?

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to