previousPEAR::_PEAR() (Previous) (Next) PEAR::registerShutdownFunc()next

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

PEAR::getStaticProperty()

PEAR::getStaticProperty() – handeld met statische properties (package developer related)

Synopsis

require_once 'PEAR.php';

mixed &PEAR::getStaticProperty ( string $class , string $var )

Description

Als je een class hebt die gedeeltelijk/helemaal statisch is, en je wil statische properties, kan je deze methode gebruiken om dat te simuleren. b.v. in je methode(s) doe je dit:

<?php
$myVar 
= &PEAR::getStaticProperty('myVar');
?>
je moet gebruik maken van een reference, anders zullen ze niet blijven bestaan!

Parameter

  • string $class - De naam van je class, waar je getStaticProperty() op hebt geroepen

  • string $var De variable op te halen.

Return value

mixed - Een reference naar de variable. Als deze leeg is, zal hij automatisch NULL worden.

Example

Using getStaticProperty()

<?php

require_once 'PEAR.php';

class 
myClass {

function 
setValue$set
{
 
$foo = &PEAR::getStaticProperty('myClass'"foo");
 
$foo $set;
}

function 
view()
{
 print 
PEAR::getStaticProperty('myClass'"foo");
}

}

myClass::setValue('value = foo');
myClass::view();
?>

Dit zal printen

value = foo
previousPEAR::_PEAR() (Previous) (Next) PEAR::registerShutdownFunc()next

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.