Cell0518 Posted March 10, 2006 Share Posted March 10, 2006 Example (from Gallery 2)$urlGenerator->makeUrl($path));for this "->", does it mean something like this?$variable "execute and set return value = to $variable" makeURL(to "$path variable" in this case)?Just trying to understand some of the more complicated code in Gallery.Thanks,Chris Quote Link to comment Share on other sites More sharing options...
naskoo Posted March 10, 2006 Share Posted March 10, 2006 sit and read some articls for Object Oriented Programing (OOP) and u'll see what it means Quote Link to comment Share on other sites More sharing options...
XenoPhage Posted March 10, 2006 Share Posted March 10, 2006 [!--quoteo(post=353605:date=Mar 10 2006, 08:11 AM:name=Cell0518)--][div class=\'quotetop\']QUOTE(Cell0518 @ Mar 10 2006, 08:11 AM) [snapback]353605[/snapback][/div][div class=\'quotemain\'][!--quotec--]Example (from Gallery 2)$urlGenerator->makeUrl($path));for this "->", does it mean something like this?$variable "execute and set return value = to $variable" makeURL(to "$path variable" in this case)?Just trying to understand some of the more complicated code in Gallery.Thanks,Chris[/quote]$urlGenerator is an object, makeUrl is a method for that object. It's basically calling the makeUrl method with an argument of $path.It doesn't appear that this is returning anything as there's no additional variable. It may be that the method creates the URL and stores it in an internal member variable. Quote Link to comment Share on other sites More sharing options...
obsidian Posted March 10, 2006 Share Posted March 10, 2006 i'll try to break it down a little simpler... although what was said above is correct. basically, the "->" operator simply refers to a member of an object. whether that member is a function or a variable, you refer to it with this operator. for instance, if i create a simple class and want to access the member variables, i would use that operator as well (within the class, it's used with the special key variable $this):[code]class User { var $name; var $nickname; function User($user, $nick) { $this->name = $user; $this->nickname = $nick; } function greet() { echo "Hello, $this->nickname!"; }}$me = new User("me", "obsidian");$me->greet();[/code]notice that my object is simply referencing its member function "greet()". hope this helps. Quote Link to comment Share on other sites More sharing options...
Cell0518 Posted March 10, 2006 Author Share Posted March 10, 2006 Thanks all,I used an example from an article, and it makes sense.Thanks again,Chris Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.