底层类型

枚举

<?php

enum Season: int {
    case Summer = 1; 
    case Fall = 2; 
    case Winter = 3; 
    case Spring = 4;
}

enum Status: string {
    case Busy = "Busy"; 
    case Available = "Available"; 
}

$winter = Season::Winter->value;
//winter is 3
$busy = Status::Busy->value;
//busy is 'Busy'

echo "winter is ", $winter, "\n";
echo "busy is '", $busy, "'";