3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum MyEnum : int { case MyEnumCase1 = 1; } $value = null; // NULL is a deprecated value. try { MyEnum::tryFrom($value); echo 'tryFrom() succeeded'."\n"; } catch (Throwable $exception) { echo 'tryFrom() failed'."\n"; echo $exception::class, ': ', $exception->getMessage(), "\n"; } /* Deprecated: MyEnum::tryFrom(): Passing null to parameter #1 ($value) of type string|int is deprecated in /in/oEp7N on line 9 tryFrom() succeeded */
Output for 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
Deprecated: MyEnum::tryFrom(): Passing null to parameter #1 ($value) of type string|int is deprecated in /in/8Wu1R on line 9 tryFrom() succeeded

preferences:
34.2 ms | 1136 KiB | 7 Q