|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[1999-11-05 20:06 UTC] zerodiv at zerodivide dot net
<?php
class Foo {
var $type;
Function Foo() {
$this->type = 'Foo';
}
}
class Bar {
var $type;
Function Bar() {
$this->type = 'Bar';
}
}
// This will work
$foo = new Foo();
echo( 'I am foo : ' . $this->type );
// This will not
$bar = new Bar();
echo( 'I should be foo also : ' . $this->type );
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
<?php class Foo { var $type; Function Foo() { $this->type = 'Foo'; } } class Bar { var $type; Function Bar() { $this->type = 'Bar'; return new Foo(); } } // This will work $foo = new Foo(); echo( 'I am foo : ' . $foo->type ); // This will not $bar = new Bar(); echo( 'I should be foo also : ' . $bar->type ); ?>