Sure
this is a problem of all languages
function a(){
b();
}
function b(){
a();
}
also creates an infinite loop
PHP cannot set a variable to something the have to create first
but how about
class a {
function a() {
if(!isset($GLOBALS["b"])) {
echo "loading b";
$GLOBALS["b"] = "dummy"
$GLOBALS["b"] = new b();
}
}
}
class b {
function b() {
if(!isset($GLOBALS["a"])) {
echo "loading a";
$GLOBALS["a"] = "dummy"
$GLOBALS["a"] = new a();
}
}
}
# creates an NOT infinite loop
new a();
Flori
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 20. Juni 2001 07:44
An: [EMAIL PROTECTED]
Betreff: [PHP-DEV] Bug #11572: global variables cannot be accessed from
an objects function?
From: [EMAIL PROTECTED]
Operating system: debian linux
PHP version: 4.0.4pl1
PHP Bug Type: Variables related
Bug description: global variables cannot be accessed from an objects
function?
class a {
function a() {
if(!isset($GLOBALS["b"])) {
echo "loading b";
$GLOBALS["b"] = new b();
}
}
}
class b {
function b() {
if(!isset($GLOBALS["a"])) {
echo "loading a";
$GLOBALS["a"] = new a();
}
}
}
# creates an infinite loop
new a();
--
Edit Bug report at: http://bugs.php.net/?id=11572&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]