How does it not work? Does it show errors? or a blank screen? does IIS crash...?


Felix Ang wrote:
I installed PHP 5 and tried phpinfo(). It worked. But then I tried OOP
sample from www.php.net <http://www.php.net/>  , like:



<?php

class MyClass {

private $Hello = "Hello, World!\n";

protected $Bar = "Hello, Foo!\n";

protected $Foo = "Hello, Bar!\n";



function printHello() {

print "MyClass::printHello() " . $this->Hello;

print "MyClass::printHello() " . $this->Bar;

print "MyClass::printHello() " . $this->Foo;

}

}



class MyClass2 extends MyClass {

protected $Foo;



function printHello() {

MyClass::printHello(); /* Should print */

print "MyClass2::printHello() " . $this->Hello; /* Shouldn't print
out anything */


print "MyClass2::printHello() " . $this->Bar; /* Shouldn't print
(not declared)*/


print "MyClass2::printHello() " . $this->Foo; /* Should print */

}

}



$obj = new MyClass();

print $obj->Hello; /* Shouldn't print out anything */

print $obj->Bar; /* Shouldn't print out anything */

print $obj->Foo; /* Shouldn't print out anything */

$obj->printHello(); /* Should print */



$obj = new MyClass2();

print $obj->Hello; /* Shouldn't print out anything */

print $obj->Bar; /* Shouldn't print out anything */

print $obj->Foo; /* Shouldn't print out anything */

$obj->printHello();

?>



It won't work.



Does anyone have the same problem?



I use PHP 5 with IIS 5.1



Brgds,

Felix Ang







-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to