BackedEnum::tryFromMaps a scalar to an enum instance or null Description
public static staticnull BackedEnum::tryFrom(intstring
$value )The tryFrom method translates a string or int into the corresponding Enum case, if any. If there is no matching case defined, it will return null. Parameters
Return ValuesA case instance of this enumeration, or null if not found. ExamplesExample #1 Basic usage The following example illustrates how enum cases are returned.
The above example will output: enum(Suit::Hearts) enum(Suit::Spades) See Also
|