Friday, October 17, 2025
HomeLanguagesPHP | ReflectionClass isUserDefined() Function

PHP | ReflectionClass isUserDefined() Function

The ReflectionClass::isUserDefined() function is an inbuilt function in PHP which is used to check if any user-defined class is available or not.
Syntax: 
 

bool ReflectionClass::isUserDefined()

Parameters: This function does not accept any parameter.
Return Value: This function returns TRUE if the user-defined class is available, otherwise FALSE.
Below programs illustrate the ReflectionClass::isUserDefined() function in PHP: 
Program 1: 
 

php




<?php
  
// Defining user-defined class Company
Class Company {
    public function neveropen() {
    }
}
  
// Using ReflectionClass over the
// defined class
$obj=new ReflectionClass('Company');
  
// Calling the isUserDefined() function
$A = $obj->isUserDefined();
  
// Getting the value true or false
var_dump($A);
?>


Output: 
 

bool(true)

Program 2: 
 

php




<?php
  
// Using a internal class 'ReflectionClass'
$obj=new ReflectionClass('ReflectionClass');
  
// Calling the isUserDefined() function
$A = $obj->isUserDefined();
  
// Getting the value true or false
var_dump($A);
?>


Output: 
 

bool(false)

Reference: https://www.php.net/manual/en/reflectionclass.isuserdefined.php
 

RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS