> How about adding an extra second parameter to print_r function, that
> would enable HTML output, with <br />s and maybe bold values?

The following would give near enough the desired effect:

<?php
  function printData($variable) {
    echo "<pre>";
    print_r($variable);
    echo "</pre>";
  }

  printData($_SERVER);
?>

However, I would like to see the function to be modified with an extra
flag which allow the resulting data to either be returned, or echoed
out... with the default being echoing out (to fit with BC). This would
allow the following to be possible (assuming the second (suggested)
paramater of print_r would return when set to true):

[function has been left in to show comparison]

<?php
  function printData($variable) {
    return "<pre>".print_r($variable,true)."</pre>";
  }

  echo printData($_SERVER);
?>

Currently, this is only possible using output buffering which i would
prefer to avoid. A real world use is logging / debugging - where you
want a print_r dump to be piped to a file / console while the rest of
the output sent to the client. [something I do quite regularly]

Would this be possible for some close version of PHP? Would it help if I
was to code a patch and submit it?

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to