Page 1 of 1

Questions about '->'

Posted: Wed Jan 31, 2007 12:51 pm
by wayneh
Hello Everyone,

I am new to this forum and PHP. I have learned a lot just by searching online and have gotten a basic understanding of how PHP works. I downloaded a website login example to find out how it works and i have a question about it. Within pretty much all the pages they have a '->'. I have no idea what this is or what it does. I assume it is equivalent to an equals operator but am not sure. Can anyone verify or correct me on this. An example of what i am talking about is below:

Code: Select all

/* Class constructor */
   function Session(){
      $this->time = time();
      $this->startSession();
   }
Thank you,

Wayne

Posted: Wed Jan 31, 2007 1:01 pm
by feyd
There's a question regarding this on page 2 :)

viewtopic.php?t=62905

Posted: Wed Jan 31, 2007 1:04 pm
by wayneh
Thank you. I'm sorry i posted again. I searched for '->' and nothing came up. Thanks very much for posting the link to the thread.

Posted: Wed Jan 31, 2007 1:48 pm
by RobertGonzalez
Yeah, the search utility would probably not return an appropriate result set when searching for those two chars together.

In a nutshell, it is an object operator (also known as an arrow operator) used in object oriented programming (OOP).

Posted: Wed Jan 31, 2007 2:02 pm
by wayneh
What is the advantage of using classes over having the scripts inside the php page?

Posted: Wed Jan 31, 2007 2:17 pm
by RobertGonzalez
Warning.... warning.... OOP vs. Procedural debate looming on the horizon....

Please search for OOP vs. Procedural before we open this flame war again. And please, to all posters, keep it civil or this thread will get locked.