From:             rc at opelgt dot org
Operating system: all
PHP version:      5.2.4
PHP Bug Type:     Feature/Change Request
Bug description:  Feature proposal for print_r (for all PHP versions!)

Description:
------------
My reason for writing was to make PHP a bit more comfortable.
I dont want to spam. I have tried to email you besides this bug 
reporting system at [EMAIL PROTECTED] without success.

You are doing your job for the same reason I do report this: idealism.

I first didnt understood what you meant with "variable container" 
cause I have studied physics, not informatics.

Now I see the problematic that only the value and not the name is 
given the function print_r.

My native language isnt english but german.

I dont know the internal means of PHP and if a method ".name" exists.
I only wanted to say it would be nice.

I think that is the critical point very often: first to say "Yes I 
understand you, what you want is a good idea, unfortunately its not so 
easy to realize."

<?php
function print_rc($variable_name)
 {
  global ${$variable_name};
  echo "Array \$$variable_name\n {\n";
  foreach(${$variable_name} as $key => $val) echo "  [$key] => 
$val\n";
  echo " }\n";
 }
$arr = array(1,2,3);
print_rc('arr');
?>

This is doing what I want. And the problem is instead giving the value 
to the function (print_r) here (print_rc) the name is given.

So my wish is incompatible with the current implementation of PHPs 
print_r.

Its a pity.

Its my part to give this suggestion and its your part to decide 
whether its a nice thing and when "yes" how that can be implemented.

You can see now that with an optional second parameter in print_r 
(interpreting the given variable as a name) or an additional new php-
function print_rc my wish is possible. With the recent implementation 
of print_r it may not be possible.

I dont want to waste my time describing the current state. I want to 
give a suggestion for the future. Realisation isnt impossible.

RĂ¼diger


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

Reply via email to