3v4l.org

run code in 500+ PHP versions simultaneously
<?php $email = Email::create('TEST@fluentbe.com'); var_dump($email); readonly class Email { final protected function __construct( private string $value, ) { } public static function create(string $value): static { $data = static::recreate($value); $data->guard(); return $data; } public static function recreate(string $value): static { return new static($value); } public function getValue(): string { return $this->value; } public function equals(self $other): bool { return $this->getValue() === $other->getValue(); } protected function guard(): void { if (preg_match("/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_'+\-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/", $this->getValue()) !== 1) { throw new \InvalidArgumentException($this->getValue()); } } }
Output for git.master_jit, git.master
object(Email)#1 (1) { ["value":"Email":private]=> string(17) "TEST@fluentbe.com" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
46.52 ms | 707 KiB | 4 Q