wcf.regNote.message
|
|
PHP Source code |
1 |
$result = $db->query("SELECT...");
|
|
|
Source code |
1 |
require_once("Cdb.php");
|
|
|
Source code |
1 |
$oDb = &new db(); |
|
|
Source code |
1 |
$oOdb->db_opn(); |
|
|
Source code |
1 |
class db {
|

|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<?
Class Foo {
var $bla,
$bar;
function Foo() // Default Konstruktor
{
// Initialisierung
$this->bla = 5;
$this->bar = 0;
}
function Foo($init) // Konstruktor mit Param
{
// Zugriff auf Membervariablen mit $this->
$this->bla = $init;
$this->bar = $init;
}
function DoSomething($add)
{
// aufrufe von Memberfunktionen auch mit $this->
$this->NeededByDoSomething($add);
return $this->bla + $this->bar;
}
function NeededByDoSomething($toadd)
{
$this->bar = $toadd;
}
}
?>
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 |
<?
include("foo.php");
$foo1 = new Foo();
$foo2 = new Foo(3);
print $foo1->DoSomething(5); // gibt 10 aus
print $foo2->DoSomething(5); // gibt 8 aus
$foo->bla = 10;
print $foo2->DoSomething(5); // gibt 15 aus
?>
|


.
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
<?
Class Foo {
var $bla,
$bar;
function Foo($init = 0) // Konstruktor mit Param und Default Wert für den Parameter
{
// Zugriff auf Membervariablen mit $this->
$this->bla = ($init ? $init : 5);
$this->bar = $init;
}
function DoSomething($add)
{
// aufrufe von Memberfunktionen auch mit $this->
$this->NeededByDoSomething($add);
return $this->bla + $this->bar;
}
function NeededByDoSomething($toadd)
{
$this->bar = $toadd;
}
}
$foo1 = new Foo();
$foo2 = new Foo(3);
print $foo1->DoSomething(5); // gibt 10 aus
print $foo2->DoSomething(5); // gibt 8 aus
$foo2->bla = 10;
print $foo2->DoSomething(5); // gibt 15 aus
?>
|
