Statement on glibc/iconv Vulnerability

UnitEnum arayüzü

(PHP 8 >= 8.1.0)

Giriş

UnitEnum arayüzü tüm sayılamalara motor tarafından özdevinimsel uygulanır. Kullanıcı tanımlı sınıflarla gerçeklenemez. Öntanımlı olarak motor tarafından sağlanan yöntemlerini sayılamalar geçersiz kılamaz. Yalnızca tür sınamaları için kullanılabilir.

Arayüz Sözdizimi

interface UnitEnum {
/* Yöntemler */
public static cases(): array
}

İçindekiler

add a note

User Contributed Notes 1 note

up
-1
leonardosahon at gmail dot com (Osahenrumwen A)
8 months ago
When looping through cases, you will need to access the values as an object and not an array, like this:

<?php

enum BlogStatus : string {
case
Published = "is_published";
case
Draft = "is_draft";
case
Scheduled = "is_scheduled";
}

foreach (
BlogStatus::case() as $datum){
echo
$datum->name . '<br />'; // Published || Draft || Scheduled
echo $datum->value . '<br />'; // is_publised || is_draft || is_scheduled
}

?>
To Top