3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TableController extends Controller { private string $tableName; private array $conditions; public function __construct() { parent::__construct(); $this->tableName = $this->urlInst->params['tableName'] ?? 'book'; } /** * 更新 */ public function editAction(): void { $requestData = json_decode(file_get_contents('php://input'), true); $params = $this->urlInst->params; $tableName = $params['tableName']; // 編集できるテーブルか検証 if (!in_array($tableName, ['book'])) { throw new IllegalPostedException("Illegal tableNamee: {$tableName}"); } if ($tableName === 'book') { $itemMapperInst = new BookMapper(); // 個別に編集に $resItems に結果を追加していく $resItems = []; foreach ($requestData as $info) { // 一部が失敗したらその内容を返し処理を続けたいので // ループ内で catch し, 再 throw はしない try { $itemInst = new Book(); $itemInst->fromAry($info); $itemMapperInst->editItem($itemInst); $resItems[] = $itemInst; } catch (SkipException $e) { $parsed_exception = $e->getParsedException(); } catch (IllegalPostedException | \Exception | \Throwable $e) { $parsed_exception = parse_exception($e); } if (isset($parsed_exception)) { save_exception_log($parsed_exception); $resItems[] = $parsed_exception; } } } else { // 他の $tableName の場合の処理 } $this->adminRender([ 'resItems' => $resItems ]); } } class BookMapper extends ItemMapper { /** * 更新 */ public function editItem(object $bookInst): void { try { $this->pdo->beginTransaction(); // uniqueId から id を取得 $rowMapperInst = new CombinedBookRowMapper(); $combinedBookId = $rowMapperInst->getIdByUniqueId($bookInst->combinedBookUniqueId); if (!$combinedBookId) { // uniqueId が存在しない場合 throw new NotFoundException("not found uniqueId: {$bookInst->combinedBookUniqueId}"); } $bookInst->combinedBookId = $rowMapperInst->getIdByUniqueId($bookInst->combinedBookUniqueId); // tbl_books テーブルをUPDATE $rowMapperInst = new BookRowMapper(); $rowMapperInst->editByBookInst($bookInst); // tbl_combined_book_titles テーブルをUPDATE $rowMapperInst = new CombinedBookTitleRowMapper(); $rowMapperInst->editByBookInst($bookInst); $this->pdo->commit(); } catch (SkipException $e) { $this->pdo->rollBack(); throw new SkipException($e->getParsedException()); } catch (\Exception $e) { $this->pdo->rollBack(); throw new SkipException(parse_exception($e)); } } }

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.10.0090.00916.80
8.5.00.0110.01020.18
8.4.160.0100.01223.73
8.4.150.0020.00114.05
8.4.140.0120.01117.44
8.4.130.0120.00917.65
8.4.120.0080.01119.50
8.4.110.0110.00924.01
8.4.100.0140.00617.81
8.4.90.0090.01020.66
8.4.80.0130.00718.73
8.4.70.0110.00818.95
8.4.60.0080.00721.98
8.4.50.0090.00920.35
8.4.40.0110.00718.00
8.4.30.0120.00620.70
8.4.20.0170.00317.85
8.4.10.0030.00619.63
8.3.280.0130.00718.65
8.3.270.0120.00716.82
8.3.260.0030.00616.75
8.3.250.0030.00516.54
8.3.240.0130.00716.70
8.3.230.0110.00816.70
8.3.220.0130.00718.91
8.3.210.0140.00516.91
8.3.200.0140.00616.70
8.3.190.0050.00517.24
8.3.180.0100.01018.90
8.3.170.0110.00720.62
8.3.160.0070.00717.33
8.3.150.0170.00317.04
8.3.140.0040.00416.76
8.3.130.0040.00416.66
8.3.120.0030.00618.87
8.3.110.0040.00420.94
8.3.100.0070.00424.06
8.3.90.0030.00626.77
8.3.80.0060.00316.50
8.3.70.0070.00716.63
8.3.60.0070.00718.30
8.3.50.0060.01216.93
8.3.40.0140.00023.79
8.3.30.0040.01119.09
8.3.20.0080.00024.18
8.3.10.0040.00424.66
8.3.00.0000.00726.16
8.2.290.0080.01016.62
8.2.280.0090.00618.57
8.2.270.0090.00918.66
8.2.260.0060.00916.63
8.2.250.0060.00316.50
8.2.240.0110.00716.74
8.2.230.0150.00322.58
8.2.220.0050.00537.54
8.2.210.0040.00426.77
8.2.200.0030.00617.00
8.2.190.0070.01116.75
8.2.180.0070.00716.63
8.2.170.0060.01218.99
8.2.160.0110.00322.96
8.2.150.0000.00825.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00020.95
8.2.110.0050.00522.11
8.2.100.0310.00418.44
8.2.90.0240.00618.44
8.2.80.0310.00318.44
8.2.70.0250.00818.44
8.2.60.0270.00418.44
8.2.50.0290.00018.44
8.2.40.0210.00718.44
8.2.30.0270.00018.44
8.2.20.0240.00318.44
8.2.10.0210.00518.44
8.2.00.0270.00018.44
8.1.330.0120.00816.29
8.1.320.0060.00716.38
8.1.310.0090.00616.52
8.1.300.0070.00318.08
8.1.290.0040.00718.88
8.1.280.0140.00025.92
8.1.270.0080.00024.66
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00322.10
8.1.230.0310.00018.44
8.1.220.0200.00418.44
8.1.210.0180.00918.44
8.1.200.0240.00318.44
8.1.190.0260.00018.44
8.1.180.0260.00718.44
8.1.170.0270.00018.44
8.1.160.0200.00718.44
8.1.150.0190.00818.44
8.1.140.0240.00318.44
8.1.130.0220.00618.44
8.1.120.0210.00418.44
8.1.110.0160.01018.44
8.1.100.0250.00418.44
8.1.90.0200.00818.44
8.1.80.0180.00918.44
8.1.70.0220.00618.44
8.1.60.0260.00018.44
8.1.50.0160.00818.44
8.1.40.0210.00418.44
8.1.30.0250.00318.44
8.1.20.0200.00718.44
8.1.10.0250.00418.44
8.1.00.0280.00518.44
8.0.300.0180.00518.44
8.0.290.0200.00818.44
8.0.280.0230.00318.44
8.0.270.0180.00718.44
8.0.260.0200.00518.44
8.0.250.0240.00318.44
8.0.240.0270.00018.44
8.0.230.0200.00718.44
8.0.220.0240.00318.44
8.0.210.0180.01118.44
8.0.200.0270.00018.44
8.0.190.0160.01218.44
8.0.180.0220.00618.44
8.0.170.0230.00718.44
8.0.160.0220.00618.44
8.0.150.0200.00318.44
8.0.140.0150.01018.44
8.0.130.0200.00018.44
8.0.120.0190.00718.44
8.0.110.0290.00018.44
8.0.100.0220.00518.44
8.0.90.0190.01118.44
8.0.80.0220.00318.44
8.0.70.0190.00718.44
8.0.60.0200.00818.44
8.0.50.0150.01018.44
8.0.30.0210.00618.44
8.0.20.0210.00418.44
8.0.10.0220.00518.44

preferences:
35.65 ms | 403 KiB | 5 Q