3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); class ScoreAnalyzer { /** * @throws InvalidArgumentException */ public function __construct(private readonly int $score, private readonly int $number){ if($score < 0 || $score > 100){ throw new InvalidArgumentException('Invalid score input'); } } public function analyzeScore(): void { echo "Score: $this->score \n"; $status = $this->determineStatus(); echo "Status: $status \n"; $grade = $this->calculateGrade(); echo "Grade: $grade\n"; echo "Number: $this->number\n"; $type = $this->findType(); echo "Type: $type\n"; } private function determineStatus(): string { return $this->score >= 60 ? "pass" : "fail"; } private function calculateGrade(): string { return match (true) { $this->score < 60 => 'F', $this->score < 70 => 'D', $this->score < 80 => 'C', $this->score < 90 => 'B', default => 'A', }; } private function findType(): string { return $this->number % 2 === 0 ? "even" : "odd"; } } try{ $scoreAnalyzer = new ScoreAnalyzer("t", 4); $scoreAnalyzer->analyzeScore(); } catch (Exception $e){ echo $e->getMessage(); }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.90.0350.00616.84
8.5.80.0350.00716.84
8.5.70.0320.00816.86
8.5.60.0360.00716.85
8.5.50.0310.00716.43
8.5.40.0340.00916.86
8.5.30.0340.00816.45
8.5.20.0360.00716.57
8.5.10.0330.01416.73
8.5.00.0130.00617.06
8.4.240.0350.00919.64
8.4.230.0300.01019.52
8.4.220.0340.00919.62
8.4.210.0310.01219.54
8.4.200.0320.01019.40
8.4.190.0360.01019.56
8.4.180.0300.01219.61
8.4.170.0170.00319.72
8.4.160.0260.00719.63
8.4.150.0150.00619.79
8.4.140.0360.00517.68
8.4.130.0280.01417.55
8.4.120.0380.00518.13
8.4.110.0330.01117.87
8.4.100.0310.00618.09
8.4.90.0300.00518.05
8.4.80.0350.00817.95
8.4.70.0320.01118.03
8.4.60.0390.01217.71
8.4.50.0360.00718.06
8.4.40.0350.01217.77
8.4.30.0350.01317.89
8.4.20.0350.00617.82
8.4.10.0420.00717.93
8.3.330.0400.01218.26
8.3.320.0350.00918.36
8.3.310.0330.00718.43
8.3.300.0330.01018.34
8.3.290.0290.01218.24
8.3.280.0330.00818.36
8.3.270.0320.00916.67
8.3.260.0300.01216.75
8.3.250.0260.00816.55
8.3.240.0200.00416.55
8.3.230.0350.00916.69
8.3.220.0330.00916.55
8.3.210.0340.00916.71
8.3.200.0310.01116.50
8.3.190.0360.00816.71
8.3.180.0290.01316.59
8.3.170.0260.00616.49
8.3.160.0250.00716.55
8.3.150.0180.00516.71
8.3.140.0170.00316.79
8.3.130.0180.00416.64
8.3.120.0260.00716.47
8.3.110.0320.00816.69
8.3.100.0340.01116.70
8.3.90.0310.00916.49
8.3.80.0340.00916.64
8.3.70.0340.01016.66
8.3.60.0330.00616.70
8.3.50.0330.01016.47
8.3.40.0370.01117.80
8.3.30.0310.00417.90
8.3.20.0260.00817.97
8.3.10.0270.00717.78
8.3.00.0280.00817.97
8.2.330.0450.01017.89
8.2.320.0330.01118.08
8.2.310.0360.00717.88

preferences:
66.14 ms | 791 KiB | 5 Q