downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

ReflectionProperty::__toString> <ReflectionProperty::setAccessible
[edit] Last updated: Fri, 24 Jun 2011

view this page in

ReflectionProperty::setValue

(PHP 5)

ReflectionProperty::setValueتعیین مقدار خاصیت

Description

public void ReflectionProperty::setValue ( object $object , mixed $value )

تعیین مقدار خاصیت.

Warning

This function is currently not documented; only its argument list is available.

Parameters

object

نام شی.

value

نام مقدار.

Return Values

No value is returned.

See Also



add a note add a note User Contributed Notes ReflectionProperty::setValue - [1 notes]
up
0
me at ircmaxell dot om
1 year ago
You can use ReflectionProperty::setValue to set the value on static properties as well as regular instance properties.  Simply pass null in place of the instance:

<?php
class Foo {
    protected static
$bar = null;
    public static function
sayBar() {
        echo
self::$bar;
    }
}

$r = new ReflectionProperty('Foo', 'bar');
$r->setAccessible(true);
$r->setValue(null, 'foo');

Foo::sayBar(); // "foo"
?>

 
show source | credits | sitemap | contact | advertising | mirror sites