PHP code example of natepisarski / unwrap-enums
1. Go to this page and download the library: Download natepisarski/unwrap-enums library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
natepisarski / unwrap-enums example snippets
enum Day: string {
case Monday = 'monday';
case Tuesday = 'tuesday';
case Wednesday = 'wednesday';
}
unwrap_enums(Day::Monday); // 'monday'
unwrap_enums([Day::Monday, Day::Tuesday]); // ['monday', 'tuesday']
unwrap_enums([Day::Monday, [Day::Tuesday, Day::Wednesday]], recursive: true); // ['monday', ['tuesday', 'wednesday']]
unwrap_enums('monday'); // 'monday' - already unwrapped
unwrap_enums(null); // null - nothing to unwrap