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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gnel2000
Forum Newbie
Posts: 16
Joined: Tue Jul 26, 2005 10:41 pm

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

Post 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.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post 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.
gnel2000
Forum Newbie
Posts: 16
Joined: Tue Jul 26, 2005 10:41 pm

Post 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?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post 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 :)
gnel2000
Forum Newbie
Posts: 16
Joined: Tue Jul 26, 2005 10:41 pm

Post 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
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post 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 :)
Post Reply