3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait Test { function init(){ $req = $this->getRequest(); $topics = $req['topics']; usort($topics, function($first, $next) { if(is_null($first['expiryDate'])) return 1; if(is_null($next['expiryDate'])) return -1; // otherwise ascending return $first['expiryDate'] <=> $next['expiryDate']; }); $req['topics'] = $topics; } } class Collection implements ArrayAccess { private $container = []; public function offsetSet($offset, $value):void { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetExists($offset):bool { return isset($this->container[$offset]); } public function offsetUnset($offset):void{ unset($this->container[$offset]); } public function offsetGet($offset):mixed { return isset($this->container[$offset]) ? $this->container[$offset] : null; } } class SchedulerRepository { use Test; protected Collection $request; /** * @return Collection */ public function getRequest(): Collection { return $this->request; } public function bootstrap($data) { $this->request = $data; $this->init(); } } $data = new Collection; $data['topics'] = [ ['expiryDate' => 9], ['expiryDate' => 6], ['expiryDate' => 7], ]; $s = (new SchedulerRepository); $s->bootstrap($data); var_dump($s);

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.30.0110.00719.53
8.5.20.0090.00719.46
8.5.10.0090.00820.12
8.5.00.0120.00920.27
8.4.180.0150.00819.79
8.4.170.0150.00623.73
8.4.160.0120.00923.92
8.4.150.0090.00417.79
8.4.140.0120.00917.30
8.4.130.0150.00517.70
8.4.120.0080.01120.60
8.4.110.0150.00522.58
8.4.100.0130.00817.84
8.4.90.0160.00617.83
8.4.80.0110.01017.81
8.4.70.0110.01017.75
8.4.60.0070.00217.64
8.4.50.0120.01019.68
8.4.40.0140.00619.50
8.4.30.0130.00720.43
8.4.20.0100.01325.75
8.4.10.0070.01023.91
8.3.300.0040.00620.79
8.3.290.0150.00518.47
8.3.280.0080.00516.26
8.3.270.0130.00716.57
8.3.260.0090.01016.76
8.3.250.0130.00620.92
8.3.240.0130.00616.51
8.3.230.0110.00716.87
8.3.220.0130.00617.18
8.3.210.0080.00716.77
8.3.200.0150.00616.72
8.3.190.0090.01016.87
8.3.180.0080.00819.09
8.3.170.0070.01116.99
8.3.160.0030.00520.14
8.3.150.0100.01017.20
8.3.140.0120.00617.32
8.3.130.0050.00318.48
8.3.120.0080.00020.82
8.3.110.0090.00018.42
8.3.100.0050.00316.74
8.3.90.0000.00826.77
8.3.80.0110.00418.43
8.3.70.0090.00616.59
8.3.60.0130.00618.31
8.3.50.0070.01116.72
8.3.40.0110.00320.30
8.3.30.0140.00418.70
8.3.20.0050.00324.18
8.3.10.0040.00424.66
8.3.00.0050.00326.16
8.2.300.0080.01220.43
8.2.290.0080.01120.51
8.2.280.0100.00918.53
8.2.270.0090.00917.17
8.2.260.0070.00716.72
8.2.250.0000.00816.66
8.2.240.0050.00517.32
8.2.230.0030.00620.94
8.2.220.0110.00037.54
8.2.210.0040.01126.77
8.2.200.0000.00916.50
8.2.190.0070.01016.58
8.2.180.0130.00718.41
8.2.170.0060.00918.98
8.2.160.0070.01122.96
8.2.150.0040.00425.66
8.2.140.0030.00524.66
8.2.130.0080.00026.16
8.2.120.0040.00426.16
8.2.110.0070.00320.53
8.2.100.0100.00417.91
8.2.90.0040.00418.03
8.2.80.0000.00818.16
8.2.70.0030.00717.92
8.2.60.0000.00818.09
8.2.50.0050.00318.10
8.2.40.0090.00019.30
8.2.30.0040.00419.41
8.2.20.0000.00819.41
8.2.10.0040.00418.23
8.2.00.0100.00517.77
8.1.340.0140.00917.69
8.1.330.0070.01216.74
8.1.320.0120.00816.00
8.1.310.0070.00418.44
8.1.300.0040.00417.48
8.1.290.0030.00630.84
8.1.280.0040.01525.92
8.1.270.0090.00024.66
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.01022.54
8.1.230.0060.00620.91
8.1.220.0090.00017.79
8.1.210.0030.00620.10
8.1.200.0030.00617.35
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0000.00818.58
8.1.160.0080.00318.85
8.1.150.0040.00418.68
8.1.140.0050.00317.46
8.1.130.0130.00217.47
8.1.120.0100.00517.54
8.1.110.0040.01217.55
8.1.100.0080.00817.51
8.1.90.0060.00917.45
8.1.80.0080.00817.48
8.1.70.0150.00017.40
8.1.60.0100.00717.68
8.1.50.0160.00317.61
8.1.40.0170.00017.58
8.1.30.0170.00317.77
8.1.20.0140.00417.77
8.1.10.0000.01717.51
8.1.00.0180.00017.41
8.0.300.0000.00920.02
8.0.290.0070.00017.00
8.0.280.0000.00718.39
8.0.270.0070.00017.89
8.0.260.0100.00516.73
8.0.250.0150.00016.95
8.0.240.0090.00616.95
8.0.230.0120.00018.57
8.0.220.0000.01416.77
8.0.210.0100.00016.88
8.0.200.0080.00018.66
8.0.190.0000.00818.57
8.0.180.0040.00418.65
8.0.170.0080.00018.65
8.0.160.0040.00418.70
8.0.150.0000.00718.59
8.0.140.0040.00418.55
8.0.130.0060.00318.55
8.0.120.0040.00418.46
8.0.110.0090.00016.74
8.0.100.0030.00616.88
8.0.90.0020.00716.84
8.0.80.0040.00416.74
8.0.70.0000.00716.71
8.0.60.0030.00316.79
8.0.50.0040.00416.72
8.0.30.0000.00716.72
8.0.20.0040.00418.62
8.0.10.0040.00416.98

preferences:
92.65 ms | 1167 KiB | 5 Q