From:             stepheneliotdewey at gmail dot com
Operating system: irrelevant
PHP version:      5.2.9
PHP Bug Type:     Feature/Change Request
Bug description:  Add optional paramter to print_r() for basic (X)HTML output 
formatting

Description:
------------
Output of print_r() is often viewed in a web browser, but in this setting,
objects are rendered as long strings that are hard to read, because they
have lots of properties, nested objects, etc.

It is much easier to view such output by viewing page source (i.e. actual
PHP output), since that will take into account newlines/whitespace
characters that are ignored by (X)HTML browsers.

However, it would be nice to have an optional parameter to make print_r()
format its output for a browser (e.g. maybe <div>'s with inline CSS padding
to force indentation, or at least <br /> and &nbsp;).

Since print_r() is primarily a debugging tool, this could be pretty handy
during development, and could encourage greater adoption of OOP practices.

ALTERNATIVELY, a tip should be added to the print_r() documentation page
telling users that arrays and objects printed by print_r() can be viewed
more easily by looking directly at the source of the output, rather than
through a browser.

Reproduce code:
---------------
N/A, see above.

Expected result:
----------------
N/A, see above.

Actual result:
--------------
N/A, see above.

-- 
Edit bug report at http://bugs.php.net/?id=48154&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48154&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48154&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48154&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48154&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48154&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48154&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48154&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48154&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48154&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48154&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48154&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48154&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48154&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48154&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48154&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48154&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48154&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48154&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48154&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48154&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48154&r=mysqlcfg

Reply via email to