This question already has answers here:
Reference Guide: What does this symbol mean in PHP? (PHP Syntax)
(24 answers)
Closed 6 years ago.
I am new at PHP and currently now i am working on moodle LMS tool.
I am referring view.php of scorm package and dont know why $cm->course this is used in php.
Please help.
Thanks in Advance
Have a look here
"->" means accessing the $cm object property course
$cm is an object, and course is a variable. Here you can see brief of PHP syntax with objects:
http://php.net/manual/en/language.types.object.php
PHP has two Object Operator namely -> and ::
-> is used when you are trying to call a method on an Instance and / or access an Instance property.
:: is used when you want to call a static method or call a parent
class's version of a method within a child class.
Reference: https://www.codeproject.com/questions/196270/what-is-meant-by-symbol-in-php
Note: I googled your exact question and got this result!
It is "object operator" - T_OBJECT_OPERATOR. It is used to access properties and methods of class on an object.
Related
This question already has answers here:
Reference Guide: What does this symbol mean in PHP? (PHP Syntax)
(24 answers)
Closed 7 years ago.
$this->var
There's a "->" symbol when we call a variable, and i'd like to know what actually does the "->" means. I tried to do some research but the textbook and the internet don't explain this clealy.
Thanks in advance.
PHP has two Object Operator namely -> and ::
-> is used when you are trying to call a method on an Instance and / or access an Instance property.
:: is used when you want to call a static method or call a parent class's version of a method within a child class.
This question already has answers here:
Reference Guide: What does this symbol mean in PHP? (PHP Syntax)
(24 answers)
What is this called in php: -> [duplicate]
(4 answers)
Closed 9 years ago.
I am trying to learn how a specific project works and while I can find most functions online, I found one that stumps me.
I see "->" appear every so often in the code, but have no idea what it does.
What does "->" mean in PHP or Joomla?
It's the object operator in PHP. It is used to access child properties and methods of classes. Its Javascript and Java equivalent is the . operator. It would be used in PHP like this
class foo{
public $bar="qux";
public function display(){
echo $this->bar;
}
}
$myFoo=new foo();
$myFoo->display(); //displays "qux"
Its like the . operator in C++ and Java. Refers to members within a class. C++ also uses the -> to access members when the variable preceding the -> is a pointer to a class rather than an instance of the class.
-> is the way used to call a method.
In C, C++, C#, Java you use . (dot) notation to call a method:
operation.sum(a, b);
In php you do it using ->
operation->sum(a,b)
This question already has answers here:
Reference Guide: What does this symbol mean in PHP? (PHP Syntax)
(24 answers)
Closed 9 years ago.
I'm a complete beginner in learning PDO for PHP and I actually haven't learned MySQL or MySQLi yet.
(Please take a look at the code below) I'm trying to make sense of what this " -> " arrow means and I couldn't find an answer anywhere else. Is the arrow semantically equivalent to the action word "perform" in every day english?
E.G for the codes below, $stmt (perform) -> closeCursor();
Code:
$stmt = $db->prepare($sql);
$stmt->execute(array($title,$entry));
$stmt->closeCursor();
Thank you.
The arrow is part of PHP's object syntax, it's saying:
$object->method();
In English is:
Run method on object
It's also used for accessing properties.
As PDO is a class in PHP and variables like $db are instances of that class, you're able to make use of the methods and properties in those instances.
Check out PHP's object docs for more info on the subject, and if you're new to Object Oriented programming then you'll need to research the subject.
That is php's object notation equivilent to . in Java and Javascript. Basically it's used to access a method or property of an object.
See the Objects and Classes documentation.
This question already has answers here:
Closed 10 years ago.
Possible Duplicates:
What does the PHP syntax $var1->$var2 mean?
Reference - What does this symbol mean in PHP?
I'm looking at a PHP framework's code, and now and then the symbols "->" appear... for example:
$controller->permissionCheck($ret);
What does "->" stand for and what is used for?
In your example, $controller is a PHP object created somewhere, and permissionCheck is a function defined in that object that is being called with the variable $ret being passed to it. Check this: Reference - What does this symbol mean in PHP?.
It's used to address a function or property of a class.
In this case a function of the controller class seems to be called.
Operator -> is for access to the non-static members of $controller object. In your case, the member is the function permissionCheck.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
what is the “::” notation in php used for?
I noticed this code while modifying a friends code and noticed this piece of code: TestPages::LoadMenu();
what does :: mean in php?
A great answer would mean a lot.
Thanks!
It's the 'Scope Resolution Operator'.
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in
simpler terms, the double colon, is a token that allows access to
static, constant, and overridden properties or methods of a class.
http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php
In layman terms it is used to call static Methods of a Class.
In your example, LoadMenu() is a static function of the TestPages class.
This means that you do not have to create an instance of a TestPages to call LoadMenu()
It is used to access static methods of class, static variables and constants
Read more
It means static class member access, in this case static method invocation.
It's used to access class methods / properties:
http://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php