<?php
// include the class
require_once('core.class.php');
// create object
$core = new Core();
// EXAMPLE CODES
// add database object
$core->Database;
// use database object
$core->Database->query("SELECT ...");
// add variable and print later
$core->test = 'test';
print $core->test;
// example use in other classes
class Foo extends Core {
public function setBar($name, $value) {
$this->Bar->{$name} = $value;
}
public function getBar($name) {
return $this->Bar->{$name};
}
}
class Bar extends Core {
public function printAll() {
return get_class_vars( __CLASS__ );
}
}
$core->Foo->setBar('foo', 'bar');
$core->Foo->setBar('lorem', 'ipsum');
print $core->Foo->getBar('foo');
// result: 'bar'
print_r( $core->Bar->printAll() );
// result:
// Array
// (
// [foo] = bar
// [lorem] = ipsum
// )
?>
|