note 48614 added to function.is-object

From: Date: Sat, 01 Jan 2005 23:49:38 +0000
Subject: note 48614 added to function.is-object
Groups: php.notes 
Request: Send a blank email to php-notes+get-82550@lists.php.net to get a copy of this message
er, I don't think that's right, especially if calling from another object instance: <? function test_this() { $c2 = new C2(); $c2->func(); $c1 = new C1(); $c1->func(); C1::func(); } class C2 { function func() { C1::func(); } } class C1 { function func() { if( isset($this) ) { if( strtolower(get_class($this)) != 'c1' ) print("oops\n"); else print("this is ok\n" ); } else { print("static call\n"); } } } test_this(); ?> yields: ---------- run-php ---------- oops this is ok static call ---- Manual Page -- http://www.php.net/manual/en/function.is-object.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48614 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48614&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48614&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48614&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48614&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48614&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48614&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48614&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#82550) next »