php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42876 Feature proposal for print_r (for all PHP versions!)
Submitted: 2007-10-06 11:55 UTC Modified: 2007-10-06 12:08 UTC
From: rc at opelgt dot org Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.4 OS: all
Private report: No CVE-ID: None
 [2007-10-06 11:55 UTC] rc at opelgt dot org
Description:
------------
Keeping in mind that print_r is a function this
function should know its parameters. Shouldn't it?

So when i use print_r($class);

why not outputting

Array $class
(
    [0] => K02
    [1] => K03
    [2] => K01
    [3] => K04
    [4] => K09
)

?



I know what I can do myself, but I think it would be of comfort when 
php itself would mention the name of the shown array.

Do you understand me?

Extending this functions features should not have any disadvantages 
except implementing maybe one line of code.

Kind regards, R?diger





Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-06 12:08 UTC] johannes@php.net
Still not possible, unless you can solve this in PHP:

<?php
function foo($a) {
  // How do you print $foo here? - Right it's impossible.
}

f($foo);
?>
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Aug 16 23:00:02 2025 UTC