#18864 [Opn->Bgs]: Nested Function within a class
| From: | rasmus@php.net | Date: | Tue, 13 Aug 2002 07:56:14 +0000 |
| Subject: | #18864 [Opn->Bgs]: Nested Function within a class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-16583@lists.php.net to get a copy of this message | ||
ID: 18864
Updated by: rasmus@php.net
Reported By: fathireza@yahoo.com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: NT2000
PHP Version: 4.2.2
New Comment:
There is absolutely no difference between:
function b() {
function c() {
}
}
and:
function b() { }
function c() { }
in terms of their calling scope. They are identical. It's not like
function c won't be defined until function b is called in the first
case. So what you are doing is meaningless.
Previous Comments:
------------------------------------------------------------------------
[2002-08-13 03:36:10] fathireza@yahoo.com
"Why would you need this functionality?" does not really
answer my question/problem.
Anyhow there is a reason for it and I am developing some
reusable classes for the project I am working on.
Thanks...
Anyhow
------------------------------------------------------------------------
[2002-08-13 01:03:30] kalowsky@php.net
Why would you need this functionality? Why not just create a second
function within the class, and call it there?
------------------------------------------------------------------------
[2002-08-12 04:07:51] fathireza@yahoo.com
Hello,
I have no access to "this variable" within the nested function.
class A{
var someX;
function b()
{
function c()
{
$this->someX=1;
//Error this variable unknow here
}
}
}
Best regards...
R. Fathi
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18864&edit=1