function foo() { global $root; //if ($result) if ($row = $db->sql_fetchrow($result)) { include $root . 'test113c.php'; $f = new MyClass(); $f->bar(); } }
<?php // implicit default constructors must not confuse the analysis $x = new MyClass(); $x->bar(); class MyClass { function bar() { echo $_GET['one']; // this one is called! } } class SomeClass { function bar() { echo $_GET['two']; } }
{ $this->bar(); } public function callBaz() { $this->baz(); } public function callFizzBuzz() { $this->fizzbuzz(); } } $class = new MyClass(); // Call methods directly $class->foo(); // This be foo, foo! $class->bar(); // This is the bar function (Tried to call bar) $class->baz(); // The amazing baz method. (Tried to call baz) $class->fizzbuzz(7); // Nothing (Tried to call fizzbuzz) echo "Calling the call functions below:\n"; $class->callFoo(); // This be foo, foo! $class->callBar(); // This is the bar function $class->callBaz(); // The amazing baz method. $class->callFizzBuzz(); // Nothing (Tried to call fizzbuzz)