PHP ReflectionClass __toString() Function Last Updated : 22 Feb, 2021 Comments Improve Suggest changes Like Article Like Report The ReflectionClass__toString() function is an inbuilt function in PHP which is used to return the string representation of the specified ReflectionClass object.Syntax: string ReflectionClass__toString( void ) Parameters: This function does not accept any parameter.Return Value: This function returns the string representation of the specified ReflectionClass object.Below programs illustrate the ReflectionClass__toString() function in PHP:Program 1: php <?php // Creating a user-defined function class Alphabets { public function A() {} public function B() {} } // Using ReflectionClass() over the // class Alphabets $class = new ReflectionClass('Alphabets'); // Calling the __toString() function $A = $class->__toString(); // Getting the string representation var_dump($A); ?> Output: string(435) "Class [ <user> class Alphabets ] { @@ /home/829bc146b7074eafd150c8e57aee5445.php 4-7- Constants [0] { }- Static properties [0] { }- Static methods [0] { }- Properties [0] { }- Methods [2] { Method [ <user> public method A ] { @@ /home/829bc146b7074eafd150c8e57aee5445.php 5 - 5 }Method [ <user> public method B ] { @@ /home/829bc146b7074eafd150c8e57aee5445.php 6 - 6 } } } " Program 2: php <?php // Using ReflectionClass() $class = new ReflectionClass('ReflectionClass'); // Calling the __toString() function $A = $class->__toString(); // Getting the string representation var_dump($A); ?> Output: string(6824) "Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {- Constants [3] { Constant [ integer IS_IMPLICIT_ABSTRACT ] { 16 } Constant [ integer IS_EXPLICIT_ABSTRACT ] { 32 } Constant [ integer IS_FINAL ] { 4 } }- Static properties [0] { }- Static methods [1] { Method [ <internal:Reflection, prototype Reflector> static public method export ] {- Parameters [2] { Parameter #0 [ <required> $argument ] Parameter #1 [ <optional> $return ] } } } . . .Method [ <internal:Reflection> public method getShortName ] {- Parameters [0] { } } } } " Reference: https://www.php.net/manual/en/reflectionclass.tostring.php Create Quiz Comment K Kanchan_Ray Follow 0 Improve K Kanchan_Ray Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP- ReflectionClass Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like