3v4l.org

run code in 300+ PHP versions simultaneously
<?php // GetUserFromApi and GetProductFromApi call for different data but both get the same error response exxception and error data // Both classes' controllers handle what is set inside the common exception "ErrorResponseException" class GetUserFromApi { /** * @throws ErrorResponseException */ function get() { try { return $this->getUserRepo->get(); } catch (HttpException $exception) { // Used by both classes - THE PROBLEM: not obvious this throws $this->handleHttpError->handle($exception); } } } class GetProductFromApi { /** * @throws ErrorResponseException */ function get() { try { return $this->getProductRepo->get(); } catch (HttpException $exception) { // Used by both classes - THE PROBLEM: not obvious this throws $this->handleHttpError->handle($exception); } } } class HandleHttpError { /** * @throws ErrorResponseException */ function handle(HttpException $exception) { // Extract data from HttpException, or set defaults if not exist // Use data to perform various tasks, then set relevant data in specific exception, log, and pass back (throw) $errorResponseException = new ErrorResponseException(various data from HttpException); $this->logger->error($errorResponseException); throw $errorResponseException; } }

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.1.40.0090.00317.38
8.1.30.0100.01017.41
8.1.20.0090.00517.30
8.1.10.0110.00517.37
8.1.00.0200.00517.40
8.0.170.0140.00616.86
8.0.160.0140.00716.71
8.0.150.0110.00816.63
8.0.140.0130.00516.67
8.0.130.0090.00316.78
8.0.120.0130.00616.74
8.0.110.0140.00316.74
8.0.100.0170.00316.72
8.0.90.0160.00016.58
8.0.80.0090.00616.65
8.0.70.0080.00816.76
8.0.60.0130.00316.66
8.0.50.0130.00316.72
8.0.30.0180.00016.83
8.0.20.0130.00516.89
8.0.10.0110.00716.92
7.4.280.0120.00816.34
7.4.270.0180.00316.38
7.4.260.0200.00016.47
7.4.250.0160.00416.34
7.4.240.0120.00816.43
7.4.230.0200.00416.36
7.4.220.0210.00416.48
7.4.210.0130.00916.41
7.4.200.0160.00416.43
7.4.190.0150.00616.48
7.4.180.0230.00016.36
7.4.160.0190.00416.46
7.4.150.0130.00416.17
7.4.140.0130.00716.27
7.4.130.0170.00316.32
7.4.120.0190.00616.23
7.4.110.0170.00516.13
7.4.100.0160.00816.34
7.4.90.0090.01416.16
7.4.80.0090.01316.21
7.4.70.0110.01116.23
7.4.60.0000.01216.27
7.4.50.0160.00616.20
7.4.40.0130.01016.01
7.4.30.0180.00416.24
7.4.20.0170.00416.29
7.4.10.0160.00616.23
7.4.00.0150.00816.03

preferences:
149.59 ms | 1288 KiB | 7 Q