Req #20459 [Opn->Bgs]: functions contained in if/else
| From: | johannes@php.net | Date: | Wed, 22 Dec 2010 14:12:16 +0000 |
| Subject: | Req #20459 [Opn->Bgs]: functions contained in if/else | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-157256@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=20459&edit=1
ID: 20459
Updated by: johannes@php.net
Reported by: pickleman78 at sbcglobal dot net
Summary: functions contained in if/else
-Status: Open
+Status: Bogus
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: Windows ME
PHP Version: 4.3.0-pre2
Block user comment: N
Private report: N
New Comment:
I don't understand the request.
Previous Comments:
------------------------------------------------------------------------
[2002-11-17 13:36:53] pickleman78 at sbcglobal dot net
sure, ok, well here is an example. Lets assume that this is a form
submitted and the action was PHP_SELF
ok
if($_POST['sent'])
{
function do_something()
{
//do stuff
}
echo("I need to use my function");
do_something();
}
else
{
echo("wait, I also need it and the author accidently put it inside that
if!");
do_something();
}
like that.
If I were to redeclare it in the else, then it tells me that i have
defuned it twice, so it obviously sees the function is defined, but if I
call it I get an error, now this can be easily solved by moving the
declaration, but I just think it would be helpful if it accidently
happened, it took me forever to figure out what I accidently did
------------------------------------------------------------------------
[2002-11-17 05:33:50] derick@php.net
Can you illustrate this with a (small) code example on how you would
like to see it? I think you also want to have a look at
php.net/function_exists .
Derick
------------------------------------------------------------------------
[2002-11-16 22:04:16] pickleman78 at sbcglobal dot net
Well, this is just a featire request/concept thing. Could you make it
where if you declare a function in an if/else statement, and you call it
outside of that statement, before it returns an error, it checks and
sees if the function was declared an if/else statement? I don't know if
this is possiblem but just a thought
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=20459&edit=1