Questions about '->'

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
wayneh
Forum Newbie
Posts: 5
Joined: Wed Jan 31, 2007 12:43 pm

Questions about '->'

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There's a question regarding this on page 2 :)

viewtopic.php?t=62905
wayneh
Forum Newbie
Posts: 5
Joined: Wed Jan 31, 2007 12:43 pm

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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).
wayneh
Forum Newbie
Posts: 5
Joined: Wed Jan 31, 2007 12:43 pm

Post by wayneh »

What is the advantage of using classes over having the scripts inside the php page?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
Post Reply