function test12() { $p = new subsubsubcounter(); echo "verify that grandfather constructor can be called, skipping parent constructor<br>\n"; echo "Result: " . ($p->count == 3 ? 'pass' : 'fail') . "<br><br>\n\n"; } function test13() { class test13class extends person { function say_hello() { return person::say_hello(); } } $p = new test13class(); echo "verifying that parentclassname::method() works.<br>\n"; echo "Result: " . ($p->say_hello() == "I am a person" ? 'pass' : 'fail') . "<br><br>\n\n"; } function test14() { class z { function identify($type) { return "I am a {$type}."; } } class zz extends z { function identify()
$o = new $type('Jim'); echo "verifying new \$class works, when \$class is a string.<br>\n"; echo "Result: " . ($o->get_name() == 'Jim' ? 'pass' : 'fail') . "<br><br>\n\n"; } function test13() { class test13class { const NUM1 = 1; const NUM2 = 2; function add_numbers() { return self::NUM1 + self::NUM2; } } $obj = new test13class(); echo "verifying self::constvar works<br>\n"; echo "Result: " . ($obj->add_numbers() == 3 ? 'pass' : 'fail') . "<br><br>\n\n"; } test1(); test2(); test3(); test4(); test5(); test5a(); test6(); test7(); test8(); test9(); test10(); test11();