PHP enum_exists() Function Last Updated : 09 Mar, 2023 Comments Improve Suggest changes Like Article Like Report The enum_exists() is an inbuilt function in PHP that checks whether the enum is defined or not in the PHP script. Syntax: enum_exists(string $enum, bool $autoload = true) Parameters: This function has two parameters. $enum: The enum name.The name is match in an insensitive manner.$autoload: This parameter specifies whether to call __autoload by default. Return Values: It returns "true" if the enum is defined otherwise it will return "false". Example 1: This code demonstrates the enum_exists() function. PHP <?php enum Season { case Spring; case Winter; } if(enum_exists(Season::class)){ echo "Season enum is defined" ; } else { echo "Season enum is not defined" ; } ?> Output: Season enum is defined Example 2: This is another example of the enum_exists() function. PHP <?php if(enum_exists(Season::class)){ echo "Season enum is defined" ; } else { echo "Season enum is not defined" ; } ?> Output: Season enum is not defined Reference: https://www.php.net/manual/en/function.enum-exists.php Comment More infoAdvertise with us Next Article PHP enum_exists() Function N neeraj3304 Follow Improve Article Tags : PHP PHP-function Similar Reads PHP | class_exists() Function The class_exists() function is an inbuilt function in PHP which is used to check whether the given class is defined or not. Syntax: bool class_exists( string $class_name, bool $autoload = TRUE ) Parameters: This function accept two parameters as mentioned above and described below: $class_name: It h 2 min read PHP key_âexists() Function The key_exists() function is an inbuilt function in PHP that is used to check whether the given key exist in the given array or not. If given key exist in the array then it returns true otherwise returns false. This function is an alias of array_key_exists() function. Syntax: bool key_exists(string| 2 min read PHP file_exists( ) Function The file_exists() function in PHP checks whether a file or directory exists on the server. It returns a boolean value:true: If the file or directory exists.false: If the file or directory does not exist or the path is incorrect.Syntax:file_exists($path)In this syntax: The file_exists() function in P 2 min read PHP method_exists() Function The method_exists() function is an inbuilt function in PHP which used to check the class method exists or not. It returns "true" if the method exists otherwise returns "false". Syntax: bool method_exists( object|string $object_or_class, string $method );Parameters: This function accepts two paramete 1 min read PHP empty() Function The empty() function in PHP checks whether a variable is empty. It returns true if the variable has a value considered "empty," such as 0, null, false, an empty string, or an unset variable, and false otherwise. Syntaxbool empty ( $var )Parameter: This function accepts a single parameter as shown in 3 min read Like