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, array($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.0150.00316.63
8.3.50.0150.00322.11
8.3.40.0190.00318.88
8.3.30.0140.00018.84
8.3.20.0000.00820.34
8.3.10.0050.00323.71
8.3.00.0040.00419.38
8.2.180.0100.00616.48
8.2.170.0070.00722.96
8.2.160.0030.01020.33
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0060.00317.63
8.2.120.0000.00726.35
8.2.110.0060.00319.27
8.2.100.0040.00717.97
8.2.90.0090.00019.40
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0000.00818.04
8.2.50.0030.00618.07
8.2.40.0080.00019.53
8.2.30.0070.00020.58
8.2.20.0040.00417.75
8.2.10.0000.00818.32
8.2.00.0000.00818.27
8.1.280.0130.01025.92
8.1.270.0100.00023.79
8.1.260.0070.00028.09
8.1.250.0080.00028.09
8.1.240.0040.00421.16
8.1.230.0000.01217.42
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0000.00817.22
8.1.180.0040.00418.10
8.1.170.0030.00618.70
8.1.160.0050.00221.99
8.1.150.0000.00718.98
8.1.140.0040.00419.60
8.1.130.0040.00417.66
8.1.120.0040.00417.48
8.1.110.0080.00017.43
8.1.100.0040.00417.40
8.1.90.0040.00417.41
8.1.80.0000.00717.47
8.1.70.0070.00017.31
8.1.60.0100.00317.68
8.1.50.0030.00617.58
8.1.40.0040.00417.64
8.1.30.0000.00817.61
8.1.20.0000.00717.70
8.1.10.0040.00417.53
8.1.00.0000.00817.54
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0030.00518.48
8.0.270.0070.00017.25
8.0.260.0030.00317.30
8.0.250.0070.00017.05
8.0.240.0000.00717.05
8.0.230.0000.00717.04
8.0.220.0000.00716.96
8.0.210.0080.00017.04
8.0.200.0030.00317.10
8.0.190.0040.00417.04
8.0.180.0070.00017.00
8.0.170.0000.01117.07
8.0.160.0040.00316.90
8.0.150.0030.00316.90
8.0.140.0070.00016.85
8.0.130.0060.00013.36
8.0.120.0040.00416.97
8.0.110.0030.00517.00
8.0.100.0050.00317.11
8.0.90.0030.00517.07
8.0.80.0070.00717.03
8.0.70.0050.00216.96
8.0.60.0080.00016.98
8.0.50.0040.00416.93
8.0.30.0080.01217.31
8.0.20.0070.01217.40
8.0.10.0020.00517.02
8.0.00.0080.01116.89
7.4.330.0000.00616.84
7.4.320.0030.00316.57
7.4.300.0000.00616.65
7.4.290.0000.00716.51
7.4.280.0000.00716.55
7.4.270.0080.00016.46
7.4.260.0000.00916.53
7.4.250.0030.00516.66
7.4.240.0040.00316.64
7.4.230.0040.00416.49
7.4.220.0120.01416.50
7.4.210.0070.00716.69
7.4.200.0040.00416.46
7.4.160.0100.01316.91
7.4.150.0040.01317.40
7.4.140.0100.01017.86
7.4.130.0080.00916.65
7.4.120.0060.01216.53
7.4.110.0090.00916.46
7.4.100.0140.00316.59
7.4.90.0100.00716.66
7.4.80.0030.01819.39
7.4.70.0060.01116.39
7.4.60.0110.00716.54
7.4.50.0070.01116.33
7.4.40.0100.00716.57
7.4.30.0080.01516.65
7.4.00.0100.00614.89
7.3.330.0000.00513.40
7.3.320.0000.00713.39
7.3.310.0050.00216.27
7.3.300.0050.00316.36
7.3.290.0060.01016.36
7.3.280.0100.00816.41
7.3.270.0090.00917.40
7.3.260.0030.01316.64
7.3.250.0100.00816.49
7.3.240.0110.00616.48
7.3.230.0100.00716.48
7.3.210.0130.00316.74
7.3.200.0060.01216.70
7.3.190.0100.00716.42
7.3.180.0060.01216.43
7.3.170.0110.00716.40
7.3.160.0080.00816.32
7.2.330.0090.00916.83
7.2.320.0190.00616.66
7.2.310.0090.00616.88
7.2.300.0160.00916.53
7.2.290.0070.01016.60
7.1.200.0030.01015.92
7.1.70.0000.00817.25
7.1.60.0070.01719.36
7.1.50.0000.01216.96
7.1.00.0070.07322.51
7.0.200.0000.00716.91
7.0.100.0300.05019.87
7.0.90.0030.08019.95
7.0.80.0100.08019.95
7.0.70.0170.07719.95
7.0.60.0200.05019.95
7.0.50.0200.07320.36
7.0.40.0100.07320.00
7.0.30.0070.05020.17
7.0.20.0170.04020.14
7.0.10.0130.07720.07
7.0.00.0130.07720.14
5.6.280.0030.04020.83
5.6.250.0130.07720.77
5.6.240.0100.07720.74
5.6.230.0030.05720.55
5.6.220.0030.08020.54
5.6.210.0070.06320.76
5.6.200.0170.07721.05
5.6.190.0100.08321.02
5.6.180.0100.04721.09
5.6.170.0130.07021.13
5.6.160.0170.06321.03
5.6.150.0070.08721.03
5.6.140.0170.06321.11
5.6.130.0100.08721.02
5.6.120.0030.09020.96
5.6.110.0030.08021.12
5.6.100.0100.08321.10
5.6.90.0070.07321.13
5.6.80.0100.07320.42
5.6.70.0100.06020.35
5.6.60.0100.06720.48
5.6.50.0100.06020.36
5.6.40.0170.07320.44
5.6.30.0030.05020.33
5.6.20.0030.07720.45
5.6.10.0030.05720.48
5.6.00.0030.07020.37
5.5.380.0070.08020.46
5.5.370.0100.08720.35
5.5.360.0030.05720.54
5.5.350.0070.07320.34
5.5.340.0000.07320.66
5.5.330.0170.07320.80
5.5.320.0100.03720.81
5.5.310.0100.05020.92
5.5.300.0070.07720.87
5.5.290.0030.05720.81
5.5.280.0130.08020.84
5.5.270.0130.04320.88
5.5.260.0070.08020.87
5.5.250.0170.07020.59
5.5.240.0130.05720.26
5.5.230.0130.04720.20
5.5.220.0100.03720.28
5.5.210.0100.07720.27
5.5.200.0070.05320.16
5.5.190.0100.05720.28
5.5.180.0130.07020.21
5.5.160.0030.05320.27
5.5.150.0130.07020.26
5.5.140.0070.07020.11
5.5.130.0070.04720.27
5.5.120.0070.04020.21
5.5.110.0130.08020.16
5.5.100.0130.06720.17
5.5.90.0100.06020.16
5.5.80.0100.07320.08
5.5.70.0000.08320.10
5.5.60.0030.04720.07
5.5.50.0130.06720.07
5.5.40.0100.05719.97
5.5.30.0200.06720.10
5.5.20.0100.07320.05
5.5.10.0100.04320.04
5.5.00.0070.07720.05

preferences:
39.44 ms | 401 KiB | 5 Q