1--TEST-- 2BackedEnum::from() 3--FILE-- 4<?php 5 6enum Suit: string { 7 case Hearts = 'H'; 8 case Diamonds = 'D'; 9 case Clubs = 'C'; 10 case Spades = 'S'; 11} 12 13var_dump(Suit::from('H')); 14var_dump(Suit::from('D')); 15var_dump(Suit::from('C')); 16var_dump(Suit::from('S')); 17 18enum Foo: int { 19 case Bar = 1; 20 case Baz = 2; 21 case Beep = 3; 22} 23 24var_dump(Foo::from(1)); 25var_dump(Foo::from(2)); 26var_dump(Foo::from(3)); 27 28?> 29--EXPECT-- 30enum(Suit::Hearts) 31enum(Suit::Diamonds) 32enum(Suit::Clubs) 33enum(Suit::Spades) 34enum(Foo::Bar) 35enum(Foo::Baz) 36enum(Foo::Beep) 37