php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #20459 functions contained in if/else
Submitted: 2002-11-16 22:04 UTC Modified: 2010-12-22 15:12 UTC
From: pickleman78 at sbcglobal dot net Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.0-pre2 OS: Windows ME
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pickleman78 at sbcglobal dot net
New email:
PHP Version: OS:

 

 [2002-11-16 22:04 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-17 05:33 UTC] 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-17 13:36 UTC] 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
 [2010-12-22 15:12 UTC] johannes@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2010-12-22 15:12 UTC] johannes@php.net
I don't understand the request.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 16:01:36 2024 UTC