3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Entity { private $name; public function __construct($name) { $this->name = $name; } public function getName() { return $this->name; } public function setName($name) { $this->name = $name; return $this; } } class DB { public function findByName($name) { if ($name === 'belette') { return new Entity($name); } return false; } } class Test { private $db; public function __construct(DB $db) { $this->db = $db; } public function getEntity($name) { $entity = $this->db->findByName($name); $new = false; if (false === $entity) { $entity = new Entity(); $entity->setName($name); $this->db->insert($entity); $new = true; } return new class($entity, $new) { private $new; public $entity; public function __construct(Entity $entity, $new) { $this->entity = $entity; $this->new = $new; } public function isNew() { return $this->new; } }; } } $db = new DB(); $test = new Test($db); $result = $test->getEntity('belette'); if ($result->isNew()) { echo "L'entité 'belette' n'existait pas en base\n"; } var_dump($result->entity->getName());

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.3.60.0150.00316.50
8.3.50.0150.00721.95
8.3.40.0070.00718.97
8.3.30.0040.01118.67
8.3.20.0080.00020.30
8.3.10.0080.00023.46
8.3.00.0050.00319.50
8.2.180.0110.00716.63
8.2.170.0190.00922.96
8.2.160.0000.01422.21
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0060.00317.63
8.2.120.0060.00326.35
8.2.110.0080.00320.59
8.2.100.0000.01217.91
8.2.90.0040.00419.18
8.2.80.0040.00417.97
8.2.70.0050.00517.50
8.2.60.0070.00317.80
8.2.50.0100.00018.07
8.2.40.0030.00619.52
8.2.30.0040.00420.57
8.2.20.0040.00417.78
8.2.10.0050.00218.24
8.2.00.0000.00718.09
8.1.280.0120.00625.92
8.1.270.0040.00422.14
8.1.260.0080.00028.09
8.1.250.0040.00428.09
8.1.240.0040.00423.92
8.1.230.0110.00017.76
8.1.220.0030.00517.74
8.1.210.0030.00618.77
8.1.200.0090.00017.48
8.1.190.0000.00817.25
8.1.180.0040.00418.10
8.1.170.0030.00620.44
8.1.160.0030.00322.05
8.1.150.0040.00418.93
8.1.140.0000.00819.61
8.1.130.0030.00617.62
8.1.120.0040.00417.54
8.1.110.0080.00017.52
8.1.100.0030.00517.39
8.1.90.0070.00017.49
8.1.80.0050.00217.45
8.1.70.0030.00317.42
8.1.60.0040.00417.55
8.1.50.0000.00817.60
8.1.40.0080.00017.43
8.1.30.0080.00017.71
8.1.20.0090.00317.73
8.1.10.0040.00417.56
8.1.00.0040.00417.54
8.0.300.0050.00318.77
8.0.290.0080.00016.88
8.0.280.0050.00318.54
8.0.270.0000.00717.30
8.0.260.0000.00717.29
8.0.250.0030.00617.03
8.0.240.0000.00716.94
8.0.230.0070.00017.05
8.0.220.0000.00816.98
8.0.210.0030.00616.98
8.0.200.0000.00816.93
8.0.190.0080.00017.08
8.0.180.0060.00316.97
8.0.170.0000.00817.03
8.0.160.0050.00317.05
8.0.150.0040.00416.90
8.0.140.0080.00016.92
8.0.130.0030.00313.41
8.0.120.0030.00616.96
8.0.110.0020.00516.98
8.0.100.0000.00716.96
8.0.90.0080.00016.86
8.0.80.0060.00917.01
8.0.70.0000.00816.98
8.0.60.0040.00416.85
8.0.50.0040.00416.87
8.0.30.0060.00916.97
8.0.20.0090.01117.44
8.0.10.0000.00717.11
8.0.00.0090.00816.84
7.4.330.0020.00216.77
7.4.320.0030.00316.55
7.4.300.0070.00016.49
7.4.290.0050.00216.53
7.4.280.0000.00716.62
7.4.270.0000.00616.44
7.4.260.0040.00416.54
7.4.250.0040.00416.45
7.4.240.0050.00216.62
7.4.230.0000.00716.61
7.4.220.0120.01216.48
7.4.210.0080.00816.54
7.4.200.0070.00016.48
7.4.160.0110.00316.36
7.4.150.0070.01117.40
7.4.140.0090.01517.86
7.4.130.0120.01216.47
7.4.120.0090.01216.40
7.4.110.0120.00616.39
7.4.100.0100.00716.48
7.4.90.0040.01416.32
7.4.80.0100.00619.39
7.4.70.0110.00716.54
7.4.60.0060.00916.54
7.4.50.0040.01116.20
7.4.40.0110.00516.53
7.4.30.0040.01316.59
7.4.00.0080.00715.09
7.3.330.0050.00013.34
7.3.320.0030.00313.32
7.3.310.0070.00016.35
7.3.300.0070.00016.27
7.3.290.0030.00316.12
7.3.280.0070.00716.28
7.3.270.0080.01517.40
7.3.260.0110.00716.32
7.3.240.0060.01216.29
7.3.230.0030.01316.39
7.3.210.0070.01016.24
7.3.200.0110.00516.40
7.3.190.0070.01016.40
7.3.180.0150.00916.57
7.3.170.0030.01316.32
7.3.160.0060.00916.39
7.3.120.0130.00614.56
7.3.110.0060.01214.64
7.3.100.0060.00314.70
7.3.90.0040.01114.95
7.3.80.0060.00614.61
7.3.70.0040.00414.77
7.3.60.0100.00314.82
7.3.50.0030.00614.84
7.3.40.0060.01014.55
7.3.30.0100.00014.79
7.3.20.0110.00416.40
7.3.10.0060.01016.31
7.3.00.0090.00816.31
7.2.330.0090.00816.67
7.2.320.0040.01316.56
7.2.310.0100.00716.71
7.2.300.0130.00316.82
7.2.290.0060.01516.70
7.2.250.0120.00015.21
7.2.240.0090.00915.07
7.2.230.0030.01214.95
7.2.220.0000.01414.91
7.2.210.0040.00814.97
7.2.200.0030.01215.02
7.2.190.0070.00314.82
7.2.180.0130.00014.90
7.2.170.0030.00615.12
7.2.130.0120.00716.75
7.2.120.0090.00916.79
7.2.110.0100.01116.52
7.2.100.0120.00716.44
7.2.90.0070.01316.88
7.2.80.0110.00916.58
7.2.70.0130.01016.54
7.2.60.0100.01016.74
7.2.50.0130.00716.59
7.2.40.0060.01316.66
7.2.30.0070.00716.68
7.2.20.0080.00616.87
7.2.10.0060.01016.60
7.2.00.0080.00917.69
7.1.330.0030.00915.51
7.1.320.0110.00315.81
7.1.310.0040.00715.39
7.1.300.0070.00315.95
7.1.290.0030.00915.61
7.1.280.0040.01115.39
7.1.270.0030.01315.95
7.1.260.0140.00015.72
7.1.250.0180.00415.53
7.1.200.0070.00315.74
7.1.100.0070.00318.11
7.1.70.0000.00817.27
7.1.60.0170.00719.48
7.1.50.0070.01117.03
7.1.00.0000.08022.55
7.0.200.0310.00614.31
7.0.60.0300.07019.93
7.0.50.0000.05717.86
7.0.40.0100.05320.16
7.0.30.0270.04020.08
7.0.20.0330.05020.19
7.0.10.0170.04320.25
7.0.00.0070.06020.06
5.6.280.0100.06321.11
5.6.210.0000.04320.70
5.6.200.0130.07318.25
5.6.190.0030.04320.33
5.6.180.0370.04020.48
5.6.170.0230.07320.71
5.6.160.0170.07020.46
5.6.150.0130.03318.21
5.6.140.0070.08018.18
5.6.130.0070.03718.23
5.6.120.0070.08021.06
5.6.110.0100.08020.98
5.6.100.0030.06720.99
5.6.90.0100.08021.11
5.6.80.0100.07720.39
5.5.350.4170.03720.42
5.5.340.0100.07017.98
5.5.330.0100.05020.19
5.5.320.0400.04020.41
5.5.310.0200.04020.30
5.5.300.0000.05317.98
5.5.290.0070.04718.08
5.5.280.0100.08320.75
5.5.270.0300.06020.78
5.5.260.0000.04320.78
5.5.250.0100.07720.71
5.5.240.0200.08320.38

preferences:
38.98 ms | 401 KiB | 5 Q