PHP code example of ivastly / php-reflection

1. Go to this page and download the library: Download ivastly/php-reflection library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ivastly / php-reflection example snippets


class ParentClass {
    private $property = 'parent private property';
}

class C extends ParentClass {

}

$object = new C();
$reflection = new \Ivastly\PhpReflection\Reflection();

$value = $reflection->getProperty($object, 'property');
$visibility = $reflection->getVisibility($object, 'property');

echo "$visibility \$property = '$value;'\n"; // private $property = 'parent private property';
bash
composer