php8.5
Home/ Manual/ reflection / reflectionclass/ ReflectionClass::export

ReflectionClass::export

PHP function Removed in PHP 8 Edit on GitHub ✎

(PHP 5, PHP 7)

Exports a class

Removed-8-0-0

Description

ReflectionClass::export(mixed $argument, bool $return = false): string

Exports a reflected class.

Parameters

argument

Name

return

Return

Return Values

Return

Examples

Basic usage of ReflectionClass::export

php
<?php
class Apple {
    public $var1;
    public $var2 = 'Orange';

    public function type() {
        return 'Apple';
    }
}
ReflectionClass::export('Apple');
?>

The above example will output something similar to:

output
Class [ <user> class Apple ] {
  @@ php shell code 1-8

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [2] {
    Property [ <default> public $var1 ]
    Property [ <default> public $var2 ]
  }

  - Methods [1] {
    Method [ <user> public method type ] {
      @@ php shell code 5 - 7
    }
  }
}

See Also

  • ReflectionClass::getName
  • ReflectionClass::__toString

Source: reference/reflection/reflectionclass/export.xml · from the official PHP manual (php/doc-en)