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('Score should be between 0 and 100'); } } public function analyzeScore(): Array { return $results = [ 'Status' => $this->determineStatus(), 'Grade' => $this->calculateGrade(), 'Number' => $this->number, 'Type' => $this->findType(), ]; } 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(77, 4); $results =$scoreAnalyzer->analyzeScore(); printf("Status: %s \nGrade: %s \nNumber: %d \nType: %s", $results['Status'], $results['Grade'], $results['Number'], $result['Type']); } catch (Throwable $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.0320.00917.04
8.5.80.0300.01116.63
8.5.70.0350.00516.71
8.5.60.0310.00916.93
8.5.50.0320.01016.64
8.5.40.0340.00716.54
8.5.30.0360.01216.81
8.5.20.0300.01416.60
8.5.10.0320.00716.67
8.5.00.0110.00416.73
8.4.240.0140.00619.84
8.4.230.0320.00919.52
8.4.220.0390.00719.77
8.4.210.0370.00719.65
8.4.200.0320.01019.20
8.4.190.0310.01219.72
8.4.180.0330.01019.52
8.4.170.0310.01119.62
8.4.160.0310.00719.85
8.4.150.0320.00819.79
8.4.140.0350.00917.91
8.4.130.0290.00817.85
8.4.120.0320.00617.94
8.4.110.0320.00418.04
8.4.100.0420.00617.80
8.4.90.0380.00818.00
8.4.80.0320.01217.88
8.4.70.0330.01117.99
8.4.60.0340.01017.97
8.4.50.0300.00818.07
8.4.40.0380.01017.85
8.4.30.0410.00417.29
8.4.20.0340.01017.85
8.4.10.0390.00917.79
8.3.330.0430.00618.56
8.3.320.0320.00818.48
8.3.310.0310.00918.61
8.3.300.0380.00718.36
8.3.290.0340.01118.42
8.3.280.0320.00918.41
8.3.270.0320.01316.84
8.3.260.0290.01516.77
8.3.250.0290.00816.81
8.3.240.0330.00916.81
8.3.230.0300.01216.96
8.3.220.0290.00816.65
8.3.210.0270.00716.52
8.3.200.0340.00916.52
8.3.190.0330.00316.81
8.3.180.0340.00916.46
8.3.170.0380.00816.81
8.3.160.0390.00816.56
8.3.150.0200.00616.89
8.3.140.0310.00716.59
8.3.130.0190.00616.44
8.3.120.0160.00716.79
8.3.110.0200.00416.88
8.3.100.0200.00916.68
8.3.90.0230.00916.46
8.3.80.0280.00616.61
8.3.70.0240.01016.79
8.3.60.0340.00916.87
8.3.50.0410.00716.65
8.3.40.0380.01018.03
8.3.30.0320.00318.04
8.3.20.0290.00718.10
8.3.10.0280.00718.11
8.3.00.0260.01017.82
8.2.330.0450.01117.97
8.2.320.0400.01017.79
8.2.310.0320.00518.17

preferences:
49.56 ms | 780 KiB | 5 Q