3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyEntity { public ?int $id = null; public ?\DateTimeImmutable $updatedAt = null; public function setUpdatedAt(): self { if (null !== $this->id || null === $this->updatedAt) { $this->updatedAt = new DateTimeImmutable(); } return $this; } } // Insert without custom date $a = new MyEntity(); $a->setUpdatedAt(); var_dump($a); // Insert with custom date $b = new MyEntity(); $b->updatedAt = new \DateTimeImmutable('2022-09-16'); $b->setUpdatedAt(); var_dump($b); // Update $c = new MyEntity(); $c->id = 42; $c->updatedAt = new \DateTimeImmutable('2022-09-16'); $c->setUpdatedAt(); var_dump($c);

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.4.120.0140.00622.50
8.4.110.0080.01322.46
8.4.100.0080.01120.48
8.4.90.0130.00818.97
8.4.80.0110.00920.79
8.4.70.0100.00818.30
8.4.60.0100.01218.80
8.4.50.0040.00618.65
8.4.40.0060.00317.98
8.4.30.0030.01620.44
8.4.20.0100.01018.09
8.4.10.0060.00319.51
8.3.250.0070.00918.95
8.3.240.0120.00116.41
8.3.230.0100.01016.77
8.3.220.0060.00319.07
8.3.210.0100.00418.55
8.3.200.0110.01016.82
8.3.190.0020.00617.35
8.3.180.0090.01216.84
8.3.170.0140.00419.08
8.3.160.0110.00718.57
8.3.150.0100.01020.80
8.3.140.0030.00616.93
8.3.130.0030.00716.74
8.3.120.0160.00019.23
8.3.110.0110.00018.50
8.3.100.0120.00618.68
8.3.90.0120.00626.77
8.3.80.0030.00718.43
8.3.70.0110.01116.88
8.3.60.0110.01118.55
8.3.50.0060.01318.65
8.3.40.0080.00620.46
8.3.30.0030.01521.73
8.3.20.0040.00424.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.290.0120.00720.32
8.2.280.0100.01020.11
8.2.270.0000.02017.49
8.2.260.0080.00019.92
8.2.250.0080.00017.04
8.2.240.0040.00417.23
8.2.230.0080.00320.94
8.2.220.0040.00724.06
8.2.210.0070.00426.77
8.2.200.0040.00416.75
8.2.190.0030.01616.63
8.2.180.0070.00716.63
8.2.170.0200.00719.02
8.2.160.0090.00622.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0030.00621.13
8.2.110.0150.00622.29
8.2.100.0190.00319.10
8.2.90.0060.01618.96
8.2.80.0040.01818.84
8.2.70.0110.01418.79
8.2.60.0150.00918.97
8.2.50.0100.01018.86
8.2.40.0110.01118.83
8.2.30.0150.00418.95
8.2.20.0140.00419.00
8.2.10.0110.01119.04
8.2.00.0070.01019.04
8.1.330.0120.00821.88
8.1.320.0110.01016.42
8.1.310.0040.00418.86
8.1.300.0060.00918.16
8.1.290.0060.00330.84
8.1.280.0030.01225.92
8.1.270.0090.00023.99
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0100.00018.65
8.1.230.0060.00318.79
8.1.220.0060.00318.73
8.1.210.0090.00319.84
8.1.200.0000.01018.69
8.1.190.0000.01018.72
8.1.180.0090.00618.64
8.1.170.0000.01018.73
8.1.160.0030.00718.81
8.1.150.0030.00720.75
8.1.140.0030.00718.75
8.1.130.0090.00618.54
8.1.120.0090.00018.71
8.1.110.0100.00018.80
8.1.100.0130.00618.54
8.1.90.0060.00618.68
8.1.80.0110.00418.69
8.1.70.0180.00318.88
8.1.60.0030.00618.88
8.1.50.0060.00318.53
8.1.40.0030.00618.88
8.1.30.0100.00319.03
8.1.20.0050.00518.80
8.1.10.0000.01018.73
8.1.00.0060.00318.86
8.0.300.0050.00518.06
8.0.290.0130.00618.20
8.0.280.0100.01018.07
8.0.270.0180.00318.26
8.0.260.0090.00918.05
8.0.250.0070.01418.27
8.0.240.0000.00918.09
8.0.230.0100.00718.63
8.0.220.0000.00918.05
8.0.210.0090.00018.12
8.0.200.0070.01018.09
8.0.190.0060.00318.26
8.0.180.0030.00717.99
8.0.170.0070.00318.10
8.0.160.0000.01021.83
8.0.150.0040.00719.88
8.0.140.0000.01118.02
8.0.130.0040.01118.05
8.0.120.0170.00318.19
8.0.110.0040.00421.66
8.0.100.0090.00018.13
8.0.90.0030.00618.13
8.0.80.0060.00617.91
8.0.70.0060.00318.13
8.0.60.0060.01321.69
8.0.50.0060.00318.25
8.0.30.0030.01217.94
8.0.20.0100.00718.38
8.0.10.0060.00318.38

preferences:
29.01 ms | 403 KiB | 5 Q