Quiz · Inheritance and interfaces · lesson 8 of 8
Quiz — a backed enum
Question 1 of 2
What does the program print?
<?php
enum Status: string
{
case Draft = 'draft';
case Live = 'live';
}
$s = Status::from('live');
$t = Status::tryFrom('x');
echo $s->name, ' ', $s->value, ' ', $t === null ? 'none' : 'some', "\n";