Jump to content

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/4604-solved-what-does-mean/
Share on other sites

[!--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.
Link to comment
https://forums.phpfreaks.com/topic/4604-solved-what-does-mean/#findComment-16121
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/4604-solved-what-does-mean/#findComment-16128
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.