Hopefully a quick and easy clarification only...With this 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:
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.