(PHP 8 >= 8.4.0)
ReflectionProperty::getRawValue — Returns the value of a property, bypassing a get hook if defined
This function is currently not documented; only its argument list is available.
Returns the value of a property, bypassing a get
hook if defined.
object
The stored value of the property, bypassing a get
hook if defined.
If the property is virtual, an Error will be thrown, as there is no raw value to retrieve.
Example #1 ReflectionProperty::getRawValue() example
<?php
class Example
{
public string $tag {
get => strtolower($this->tag);
}
}
$example = new Example();
$example->tag = 'PHP';
$rClass = new \ReflectionClass(Example::class);
$rProp = $rClass->getProperty('tag');
/ These would go through the get hook, so would produce "php"
echo $example->tag, PHP_EOL;
echo $rProp->getValue($example), PHP_EOL;
/ But this would bypass the hook and produce "PHP"
echo $rProp->getRawValue($example);
?>
The above example will output:
php php PHP
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant