Req #47453 [Opn->Spm]: A new language construct for var_dump'ing and returning a value
| From: | jani@php.net | Date: | Sun, 02 Jan 2011 01:05:25 +0000 |
| Subject: | Req #47453 [Opn->Spm]: A new language construct for var_dump'ing and returning a value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-157500@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=47453&edit=1
ID: 47453
Updated by: jani@php.net
Reported by: Progman2002 at gmx dot de
Summary: A new language construct for var_dump'ing and
returning a value
-Status: Open
+Status: Spam
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
PHP Version: 5.2.9RC2
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2009-02-19 19:49:41] Progman2002 at gmx dot de
Description:
------------
During debugging and helping other users you want to
print/debug/var_dump a value to check its value. Currently you write
something like var_dump($sql); before you use the variable to check its
content. But it may be better to just use a language construct which
1. output the parameter as like var_dump do
2. return the parameter as like without the language construct. As an
example this language construct could be named "debugprint" and be used
as followed.
// original code
mysql_query(a_function_which_generates_a_query());
// old-debugging style
var_dump($sql = a_function_which_generates_a_query());
mysql_query($sql);
// using of "debugprint"
mysql_query(debugprint a_function_with_generates_a_query());
It must be a language construct and not a function as it should be
easily prepended before any possible value without writing a closing
parentheses for a function call.
// bad
mysql_query(debugprint(a_function_with_generates_a_query()));
// good
mysql_query(debugprint a_function_with_generates_a_query());
So you can simply remove this keyword/statement if not needed anymore
(and dont need to check which parenthese you must remove aswell).
Note: I'm not talking here about using a professional debugger as other
people may help other people with their scripts they wrote. These people
may don't use a professional debugger at all and only know
"echo-debugging". So instead of saying "save the return value of the
function in a variable and output it with var_dump for debugging" it
could be just "write 'debugprint' before your function to check the
return value" and the script itself is still running (as the language
construct returns the value, too)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=47453&edit=1