Tuesday, March 4, 2014

stdClass in PHP




stdClass is php's generic empty class. It is auto casted.
For example, moodle LMS used stdclass in its config.php

 unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'root';

$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbsocket' => 0,
);

No comments:

Post a Comment