Page 1 of 1

What is mean by this $data->_ole->read

Posted: Thu Oct 27, 2005 10:52 pm
by gnel2000
i'm new to php, don't really understand what is this mean:

$data->_ole->read()

as i know, $data->read() is calling method from a class.

Please help.

Posted: Fri Oct 28, 2005 12:57 am
by Jenk
$data is the object, _ole is a property of that object, read() is a method, of the property _ole, of the object $data.

Posted: Fri Oct 28, 2005 1:09 am
by gnel2000
hm, then what the script is doing?

i really have no idea what are the script doing... :(

issit mean, this will return result to _ole?
can i say _old is a variable?

Posted: Fri Oct 28, 2005 1:17 am
by Jenk
$data will be an object instance of a class

In your script somewhere, you will find a line similar to:

Code: Select all

<?php

$data = new className();

?>
Where className will actually be the name of the class, and there may be some arguments passed aswell.

_ole will be a property of $data, or to be more precise, an object property, so somewhere within the class className, there will be a line such as:

Code: Select all

<?php

class className() 
{

  var $_ole;

  function className()
  {
    $this->_ole = new otherClassName();
  }
}
and read will be a member function (method) of the otherClassName object _ole

Code: Select all

<?php

class otherClassName
{

  function read () 
  {
    //do stuff
  }
}

?>
And without seeing the code, I couldn't possibly tell you what it is doing, other than "reading" something :)

Posted: Fri Oct 28, 2005 1:21 am
by gnel2000
hm, this means the line is actually calling other's class method!
am i right? :D

thanks q very much, i have been ask many people but no one's explanation make me clear.

thanks once again. :D :P

Posted: Fri Oct 28, 2005 1:25 am
by Jenk
You are correct - to an extent :p

It is calling the object instance of the other clasess method, there is a very subtle difference :)