class Status
{
public const PENDING = 'pending';
public const ACTIVE = 'active';
}
$status = Status::ACTIVE;enum Status: string
{
case Pending = 'pending';
case Active = 'active';
}
$status = Status::Active;$fiber = new Fiber(function (): void {
$value = Fiber::suspend('paused');
echo "Resumed with: {$value}\n";
});
$output = $fiber->start();
echo "Status: {$output}\n";
$fiber->resume('ready');class User
{
private string $name;
public function __construct(string $name)
{
$this->name = $name;
}
public function getName(): string
{
return $this->name;
}
}class User
{
public function __construct(
public readonly string $name
) {}
}$fn = Closure::fromCallable('strlen');
$length = $fn('test');$fn = strlen(...);
$length = $fn('test');