PHP code example of tourze / operation-system-enum
1. Go to this page and download the library: Download tourze/operation-system-enum 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/ */
tourze / operation-system-enum example snippets
use Tourze\OperationSystemEnum\Platform;
// Get all platform cases
$platforms = Platform::cases();
// Get platform by value
$platform = Platform::from('WINDOWS');
// Get platform with fallback
$platform = Platform::tryFrom('INVALID'); // returns null
// Get platform label
echo Platform::WINDOWS->getLabel(); // "Windows"
echo Platform::ANDROID->getLabel(); // "安卓"