3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ClassName { private $property = 42; } $obj = new ClassName(); var_dump($obj); $refObject = new ReflectionObject( $obj ); $refProperty = $refObject->getProperty( 'property' ); $refProperty->setAccessible( true ); //$refProperty->setValue($obj, 'new value'); $obj->property = 'miauw'; var_dump($obj);

preferences:
44.96 ms | 402 KiB | 5 Q