Beispiel #1
0
        self::$id += 1;
    }
    public static function checkIdFromStaticMehod()
    {
        echo "Current Id From Static Method is " . self::$id . "\n";
    }
    public function checkIdFromNonStaticMethod()
    {
        echo "Current Id From Non Static Method is " . self::$id . "\n";
    }
}
$st1 = new StaticTester();
StaticTester::checkIdFromStaticMehod();
$st2 = new StaticTester();
echo "<br/>";
$st2->checkIdFromNonStaticMethod();
echo "<br/>";
abstract class AbstractClass
{
    // Our abstract method only needs to define the required arguments
    protected abstract function prefixName($name);
}
class ConcreteClass extends AbstractClass
{
    // Our child class may define optional arguments not in the parent's signature
    public function prefixName($name, $separator = ".")
    {
        if ($name == "Pacman") {
            $prefix = "Mr";
        } elseif ($name == "Pacwoman") {
            $prefix = "Mrs";
$newemailerobject->setBody('Hi there :D');
$newemailerobject->sendEmail();
$newemailerobject->sendHtmlEmail();
/*----------  DBDriver  ----------*/
$dbdriver = DBManager::getMySQLDriver();
/*----------  Static Tester  ----------*/
$tester = new StaticTester();
print "<br>";
StaticTester::checkIdFromStaticMethod();
print "<br>";
$tester2 = new StaticTester();
$tester->checkIdFromNonStaticMethod();
print "<br>";
$tester->checkIdFromStaticMethod();
print "<br>";
$tester2->checkIdFromNonStaticMethod();
print "<br>";
$tester3 = new StaticTester();
StaticTester::checkIdFromStaticMethod();
print "<br>";
/*----------  Student  ----------*/
$student = new Student();
$student->name = "Gilmar";
$student->roll = 19;
print "{$student->name}<br>";
print "{$student->roll}<br>";
/*----------  Overloader  ----------*/
$ol = new Overloader();
$ol->access(2, 3, 4);
print "</br>";
$ol->notAnyMethod("boo");