1. Go to this page and download the library: Download nilay-jp/php-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/ */
namespace com.example.app;
use jp\nilay\enum\Enum;
class Height extends Enum
{
#[Enum]
public static function HIGH(): Height { return new static(); }
#[Enum]
public static function MEDIUM(): Height { return new static(); }
#[Enum]
public static function LOW(): Height { return new static(); }
}
namespace com.example.app;
use jp\nilay\enum\Enum;
class Height extends Enum
{
protected string $name;
protected string $abbr;
public function __construct(string $name, string $abbr)
{
parent::__construct();
$this->name = $name;
$this->abbr = $abbr;
}
public function getName(): string
{
return $this->name;
}
public function getAbbr(): string
{
return $this->abbr;
}
#[Enum]
public static function HIGH(): Height { return new static("High", "H"); }
#[Enum]
public static function MEDIUM(): Height { return new static("Medium", "M"); }
#[Enum]
public static function LOW(): Height { return new static("Low", "L"); }
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.