3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Cart { public function save(object $repo = null) { if ($repo === null || !$repo instanceof CartRepository) { throw new Exception('Save the cart using the CartRepository' . "\n"); } $repo->save($this); } } class CartRepository { public function save(Cart $cart) { return 'saved!'; } } $repo = new CartRepository(); $cart = new Cart(); try { $cart->save(); } catch (Exception $e) { echo $e->getMessage(); } echo $repo->save($cart);

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.70
8.5.00.0100.01220.03
8.4.150.0020.00014.05
8.4.140.0140.00817.77
8.4.130.0120.00718.13
8.4.120.0100.00920.27
8.4.110.0120.00522.38
8.4.100.0150.00618.05
8.4.90.0060.00320.61
8.4.80.0040.00618.89
8.4.70.0050.00320.81
8.4.60.0180.00320.47
8.4.50.0080.01220.44
8.4.40.0030.01418.70
8.4.30.0060.01219.08
8.4.20.0160.00619.63
8.4.10.0080.00019.60
8.3.280.0170.00618.38
8.3.270.0120.00716.63
8.3.260.0100.00916.72
8.3.250.0090.01118.95
8.3.240.0130.00616.39
8.3.230.0110.01016.82
8.3.220.0040.00418.83
8.3.210.0050.00316.48
8.3.200.0060.00216.92
8.3.190.0030.00517.29
8.3.180.0130.00518.73
8.3.170.0120.00617.20
8.3.160.0100.01016.73
8.3.150.0110.00716.70
8.3.140.0000.00816.73
8.3.130.0070.01318.37
8.3.120.0060.00320.80
8.3.110.0030.00620.94
8.3.100.0130.00616.49
8.3.90.0000.00826.77
8.3.80.0060.00316.63
8.3.70.0130.00316.63
8.3.60.0110.00718.36
8.3.50.0040.01116.80
8.3.40.0170.00719.57
8.3.30.0160.00619.22
8.3.20.0160.00621.76
8.3.10.0150.00621.72
8.3.00.0110.01118.95
8.2.290.0090.01017.28
8.2.280.0110.00818.30
8.2.270.0100.00016.83
8.2.260.0120.00316.87
8.2.250.0090.01216.88
8.2.240.0060.00318.83
8.2.230.0090.00022.58
8.2.220.0040.00424.06
8.2.210.0090.00026.77
8.2.200.0090.00016.63
8.2.190.0110.00316.63
8.2.180.0030.01416.75
8.2.170.0110.01118.97
8.2.160.0090.01320.14
8.2.150.0100.01419.19
8.2.140.0160.00620.50
8.2.130.0070.01120.38
8.2.120.0060.01219.45
8.2.110.0000.01819.35
8.2.100.0140.00419.26
8.2.90.0090.00918.67
8.2.80.0070.01019.35
8.2.70.0120.00618.90
8.2.60.0070.01118.81
8.2.50.0140.00319.28
8.2.40.0100.01018.95
8.2.30.0160.00318.82
8.2.20.0070.01118.79
8.2.10.0100.01018.45
8.2.00.0160.00318.57
8.1.330.0140.00516.27
8.1.320.0140.00718.04
8.1.310.0120.00616.64
8.1.300.0030.00718.62
8.1.290.0000.00830.84
8.1.280.0140.00425.92
8.1.270.0090.00922.20
8.1.260.0140.00421.92
8.1.250.0060.01321.98
8.1.240.0170.00318.61
8.1.230.0120.00918.62
8.1.220.0140.00418.86
8.1.210.0130.00618.55
8.1.200.0140.00418.79
8.1.190.0070.01018.66
8.1.180.0090.00918.37
8.1.170.0040.01518.69
8.1.160.0090.00918.48
8.1.150.0040.01818.91
8.1.140.0030.01918.74
8.1.130.0090.00918.64
8.1.120.0070.01118.59
8.1.110.0040.01418.59
8.1.100.0120.00619.74
8.1.90.0150.00418.44
8.1.80.0090.00919.73
8.1.70.0030.01718.88
8.1.60.0160.00618.75
8.1.50.0040.01418.68
8.1.40.0070.01118.50
8.1.30.0090.00918.90
8.1.20.0110.00719.93
8.1.10.0120.00618.75
8.1.00.0110.01118.35

preferences:
86.92 ms | 403 KiB | 5 Q