questioning against $CFG -> sorry i am newbie

Re: questioning against $CFG -> sorry i am newbie

by Samuli Karevaara -
Number of replies: 0
As PHP is a loosely typed language, you can just introduce an object without specifying what it is. Internally it becomes of type "stdClass". The $CFG object is of this type. You can peek at the internals of an object with
var_dump($CFG);

Try for example (without introducing $PERSON anywhere):
$PERSON->name = "Samuli";
var_dump($PERSON);

Though the double-O in Moodle stands for "object-oriented", there is a lot of functional programming style code in it. I see this more as a "pro" than a "con". In some places introducing classes could improve the readability of the code, gathering the parameters together. $CFG might be one of those places.