| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [1999-03-11 14:51 UTC] jonsmirl at mediaone dot net
 A pointer to an object is not behaving the same as the $this pointer inside of the same object.
$obj = new oObject;
$obj->checkme($obj);
class oObject {
    function checkme($obj) { 
// this list will include the member function and properties
        while ( list( $key, $val ) = each( $obj ) ) { 
            printf("AA %s => %s (%s)", $key, $val, gettype($val)); 
        } 
// this list only shows the properties
        while ( list( $key, $val ) = each( $this ) ) { 
            printf("BB %s => %s (%s)", $key, $val, gettype($val)); 
        } 
    }
}
I would have expected the $this pointer to provide me with the list of functions too.
I need this function list to construct a remote proxy to the object.
Jon Smirl
jonsmirl@mediaone.net
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 10:00:02 2025 UTC | 
You are not resetting the object properly. This works: class Object { function checkme($obj) { reset($obj); while(list($key, $val) = each($obj)) { printf("AA %s => %s (%s)\n", $key, $val, gettype($val)); } reset($this); while(list($key, $val) = each($this)) { printf("BB %s => %s (%s)\n", $key, $val, gettype($val)); } } } $obj = new Object; $obj->checkme($obj);