0

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

Swanand
  • 489
  • 1
  • 6
  • 25

4 Answers4

1

Have a look here "->" means accessing the $cm object property course

Froxz
  • 3,499
  • 4
  • 31
  • 59
1

$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

Daimos
  • 1,443
  • 9
  • 25
1

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!

masterFly
  • 1,047
  • 8
  • 20
1

It is "object operator" - T_OBJECT_OPERATOR. It is used to access properties and methods of class on an object.