3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { $orderedids=array(7, 9, 5, 3); $tags=array( new Tag(3), new Tag(7), new Tag(5), new Tag(9) ); $flipped=array_flip($orderedids); $sorter=new stdClass(); $sorter->flipped=$flipped; $sorter->sfunct=function($tag1, $tag2) { if ($this->flipped[$tag1->id]<$this->flipped[$tag2->id]) return -1; else if ($this->flipped[$tag1->id]==$this->flipped[$tag2->id]) return 0; else return 1; }; return usort($tags, $sorter->sfunct); } class Tag { public $id; function __construct($id) { $this->id=$id; } } $rtags=test(); foreach ($rtags as $tag) echo $tag->id." ";

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.0040.01116.88
8.3.50.0040.01118.17
8.3.40.0110.00418.93
8.3.30.0150.00018.80
8.3.20.0050.00320.24
8.3.10.0050.00223.70
8.3.00.0050.00319.50
8.2.180.0040.01116.63
8.2.170.0110.00422.96
8.2.160.0070.00720.35
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00720.08
8.2.110.0030.00920.39
8.2.100.0080.00318.03
8.2.90.0000.00819.26
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0080.00017.93
8.2.50.0030.00618.07
8.2.40.0040.00419.52
8.2.30.0040.00420.68
8.2.20.0040.00417.64
8.2.10.0040.00418.05
8.2.00.0070.00018.15
8.1.280.0040.01425.92
8.1.270.0030.00623.97
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0000.01017.36
8.1.230.0110.00017.42
8.1.220.0000.00917.74
8.1.210.0030.00618.77
8.1.200.0030.00617.35
8.1.190.0080.00017.23
8.1.180.0040.00418.10
8.1.170.0040.00418.62
8.1.160.0000.00721.96
8.1.150.0040.00418.93
8.1.140.0060.00319.53
8.1.130.0030.00517.66
8.1.120.0070.00017.41
8.1.110.0070.00317.45
8.1.100.0050.00217.51
8.1.90.0000.00717.41
8.1.80.0080.00017.47
8.1.70.0000.00817.43
8.1.60.0090.00317.64
8.1.50.0030.00517.50
8.1.40.0040.00417.59
8.1.30.0040.00417.61
8.1.20.0040.00417.63
8.1.10.0000.00717.53
8.1.00.0000.00717.43
8.0.300.0060.00318.77
8.0.290.0050.00316.75
8.0.280.0000.00818.39
8.0.270.0070.00017.35
8.0.260.0000.00617.33
8.0.250.0030.00317.03
8.0.240.0060.00017.07
8.0.230.0070.00017.04
8.0.220.0020.00516.86
8.0.210.0030.00616.85
8.0.200.0050.00317.09
8.0.190.0000.00716.98
8.0.180.0040.00417.01
8.0.170.0030.00616.99
8.0.160.0040.00417.06
8.0.150.0040.00417.01
8.0.140.0030.00416.90
8.0.130.0000.00613.38
8.0.120.0000.00916.99
8.0.110.0000.00717.00
8.0.100.0040.00416.87
8.0.90.0080.00016.84
8.0.80.0060.01016.93
8.0.70.0000.00716.93
8.0.60.0000.00717.05
8.0.50.0040.00416.83
8.0.30.0090.00717.08
8.0.20.0140.00517.40
8.0.10.0080.00016.93
8.0.00.0140.00616.82
7.4.330.0050.00016.77
7.4.320.0060.00016.58
7.4.300.0030.00616.62
7.4.290.0040.00416.45
7.4.280.0020.00516.52
7.4.270.0000.00816.61
7.4.260.0030.00316.38
7.4.250.0000.00916.41
7.4.240.0050.00216.67
7.4.230.0000.00716.46
7.4.220.0060.01316.48
7.4.210.0000.01916.53
7.4.200.0080.00016.54
7.4.160.0110.01116.58
7.4.150.0140.00617.40
7.4.140.0060.01517.86
7.4.130.0060.01116.58
7.4.120.0100.00816.64
7.4.110.0070.01016.77
7.4.100.0140.00516.29
7.4.90.0070.01016.64
7.4.80.0150.00819.39
7.4.70.0140.00616.54
7.4.60.0170.00016.61
7.4.50.0000.01716.57
7.4.40.0140.00316.51
7.4.30.0160.00616.57
7.4.00.0050.00514.87
7.3.330.0050.00013.21
7.3.320.0000.00713.34
7.3.310.0000.00716.44
7.3.300.0000.00716.33
7.3.290.0060.00916.36
7.3.280.0120.00816.41
7.3.270.0110.00617.40
7.3.260.0130.00316.57
7.3.250.0130.00516.52
7.3.240.0120.00816.44
7.3.230.0060.01216.39
7.3.210.0140.00316.38
7.3.200.0060.00916.42
7.3.190.0130.00416.45
7.3.180.0080.00916.31
7.3.170.0120.00916.50
7.3.160.0150.00916.52
7.2.330.0150.00316.71
7.2.320.0130.01016.72
7.2.310.0130.00316.60
7.2.300.0120.00616.73
7.2.290.0090.01216.79
7.2.60.0190.00816.27
7.2.00.0040.01119.57
7.1.200.0070.00715.84
7.1.100.0030.01318.27
7.1.70.0120.01217.15
7.1.60.0060.01919.36
7.1.50.0060.01617.02
7.1.00.0070.07022.54
7.0.200.0030.00716.55
7.0.60.0070.07719.96
7.0.50.0070.08017.90
7.0.40.0130.08020.05
7.0.30.0300.06320.23
7.0.20.0300.06720.19
7.0.10.0130.08320.26
7.0.00.0130.08020.06
5.6.280.0000.03321.08
5.6.210.0100.07720.55
5.6.200.0070.08018.16
5.6.190.0070.08720.48
5.6.180.0400.04020.61
5.6.170.0370.07720.62
5.6.160.0030.09320.55
5.6.150.0130.05718.16
5.6.140.0070.04718.14
5.6.130.0030.04318.19
5.6.120.0030.04721.00
5.6.110.0000.08021.15
5.6.100.0070.06720.89
5.6.90.0170.07720.98
5.6.80.0130.07720.39
5.5.350.4230.04020.33
5.5.340.0030.08317.99
5.5.330.0070.05320.46
5.5.320.0100.04020.31
5.5.310.0270.03320.23
5.5.300.0070.05717.98
5.5.290.0030.08718.04
5.5.280.0070.06020.84
5.5.270.0070.05720.88
5.5.260.0100.04020.97
5.5.250.0100.06320.70
5.5.240.0300.06320.29

preferences:
53.58 ms | 400 KiB | 5 Q