3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PilotId { protected $pid; /** * @param PilotId|string $pid */ public function __construct($pid){ if(!preg_match("^(AFA|PAY)([0-9]{4})$", (string)$pid)) throw new \InvalidArgumentException('Invalid PID'); $this->pid = $pid; } function __toString(){ return $this->pid; } }

preferences:
84.36 ms | 402 KiB | 5 Q