Created
July 11, 2021 01:53
-
-
Save shin1x1/9e438db47a0025cc825a560a22ab6a3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
enum Color: int { | |
case Red = 1; | |
case Blue = 2; | |
case Green = 3; | |
} | |
function foo(Color $color) { | |
var_dump($color); | |
var_dump($color->name); | |
} | |
foo(Color::Red); | |
foo(Color::from(2)); | |
var_dump(Color::cases()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment