Hopefully a quick and easy clarification only...With th开发者_开发技巧is code found in an action in a controller:
...
$SaveAccount = new SaveAccount();
$SaveAccount->saveAccount($username, $password, $email);
...
Does the second line mean "run the method "saveAccount()" on the new object? Is that what the ->
means?
Thanks!
The ->
is used with objects. In below line:
$SaveAccount->saveAccount($username, $password, $email);
The saveAccount
method is run of the object $SaveAccount
I would suggest you to have a look at:
Object Oriented Programming with PHP
Does the second line mean "run the method "saveAccount()" on the new object?
Yes.
Is that what the
->
means?
No, it means "fetch the method or property" named saveAccount
. Together ()
it gains the meaning "run the method "saveAccount()". Note: technically, you cannot fetch a method without executing it, so $obj->methodname
has no meaning without ()
, but this explanation may help you conceptually.
精彩评论