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); class Sorter { public $flipped; function __construct($flipped) { $this->flipped=$flipped; } function fsort($tag1, $tag2) { return $this->flipped[$tag1->id] <=> $this->flipped[$tag2->id]; 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; } } $sorter=new Sorter($flipped); usort($tags, array($sorter, "fsort")); return $tags; } 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.40.0110.00418.58
8.3.30.0120.00318.75
8.3.20.0000.00720.34
8.3.10.0080.00023.65
8.3.00.0080.00019.50
8.2.170.0090.00622.96
8.2.160.0030.01320.41
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0030.00617.50
8.2.120.0050.00326.35
8.2.110.0060.00320.94
8.2.100.0000.01117.91
8.2.90.0030.00517.91
8.2.80.0080.00017.97
8.2.70.0000.00917.63
8.2.60.0030.00618.05
8.2.50.0060.00318.07
8.2.40.0030.00619.39
8.2.30.0040.00320.52
8.2.20.0030.00517.78
8.2.10.0050.00318.15
8.2.00.0000.00818.02
8.1.270.0080.00024.04
8.1.260.0000.00828.09
8.1.250.0000.00728.09
8.1.240.0090.00022.46
8.1.230.0060.00620.92
8.1.220.0080.00017.77
8.1.210.0030.00518.86
8.1.200.0000.00917.47
8.1.190.0060.00617.34
8.1.180.0050.00318.10
8.1.170.0040.00418.80
8.1.160.0060.00322.04
8.1.150.0000.00818.91
8.1.140.0030.00619.48
8.1.130.0000.00817.76
8.1.120.0040.00417.49
8.1.110.0060.00617.45
8.1.100.0040.00417.36
8.1.90.0040.00417.39
8.1.80.0060.00317.43
8.1.70.0030.00517.49
8.1.60.0000.00817.52
8.1.50.0030.00617.54
8.1.40.0040.00417.52
8.1.30.0040.00417.69
8.1.20.0040.00417.57
8.1.10.0000.00817.59
8.1.00.0060.00617.53
8.0.300.0000.00720.03
8.0.290.0040.00416.63
8.0.280.0030.00318.39
8.0.270.0000.00717.18
8.0.260.0000.00717.23
8.0.250.0030.00316.98
8.0.240.0000.00716.96
8.0.230.0090.00016.98
8.0.220.0030.00516.84
8.0.210.0040.00417.00
8.0.200.0030.00317.02
8.0.190.0070.00017.00
8.0.180.0000.00716.95
8.0.170.0000.00716.91
8.0.160.0050.00316.89
8.0.150.0040.00416.81
8.0.140.0000.00716.80
8.0.130.0000.00513.30
8.0.120.0080.00016.84
8.0.110.0040.00416.92
8.0.100.0040.00416.70
8.0.90.0000.00716.87
8.0.80.0150.00016.90
8.0.70.0040.00416.91
8.0.60.0030.00616.79
8.0.50.0040.00416.71
8.0.30.0130.00917.20
8.0.20.0120.00617.44
8.0.10.0030.00616.94
8.0.00.0110.01016.79
7.4.330.0000.00516.67
7.4.320.0070.00016.56
7.4.300.0030.00316.61
7.4.290.0030.00316.51
7.4.280.0000.00816.46
7.4.270.0000.00716.66
7.4.260.0030.00516.58
7.4.250.0070.00016.48
7.4.240.0030.00416.56
7.4.230.0030.00316.43
7.4.220.0060.01316.52
7.4.210.0090.01216.66
7.4.200.0050.00316.53
7.4.160.0080.00816.34
7.4.150.0100.00717.40
7.4.140.0100.00917.86
7.4.130.0120.00516.62
7.4.120.0090.00916.58
7.4.110.0090.00916.55
7.4.100.0190.00616.72
7.4.90.0030.01316.46
7.4.80.0180.00919.39
7.4.70.0100.00616.50
7.4.60.0100.00616.71
7.4.50.0030.01216.52
7.4.40.0030.01316.64
7.4.30.0200.00316.51
7.4.00.0100.00715.15
7.3.330.0030.00313.43
7.3.320.0030.00313.31
7.3.310.0070.00016.20
7.3.300.0000.00716.39
7.3.290.0060.01116.38
7.3.280.0100.00516.38
7.3.270.0100.00717.40
7.3.260.0090.00916.42
7.3.250.0080.01216.45
7.3.240.0100.00816.45
7.3.230.0140.00316.45
7.3.210.0120.01216.37
7.3.200.0040.01416.31
7.3.190.0040.01216.51
7.3.180.0100.00716.41
7.3.170.0120.00616.42
7.3.160.0150.00416.60
7.2.330.0060.01016.81
7.2.320.0110.00616.76
7.2.310.0090.00816.69
7.2.300.0060.01016.43
7.2.290.0030.01316.70
7.2.60.0070.00716.86
7.2.00.0030.00919.52
7.1.200.0040.00715.72
7.1.100.0100.00318.28
7.1.70.0000.00816.83
7.1.60.0090.01619.36
7.1.50.0000.01416.99
7.1.00.0100.07022.28
7.0.200.0060.00316.67
7.0.60.0070.06720.00
7.0.50.0070.04717.89
7.0.40.0170.08320.15
7.0.30.0170.04720.16
7.0.20.0300.07720.21
7.0.10.0070.05320.06
7.0.00.0100.07720.05
5.6.280.0000.06720.87
5.6.210.0130.03720.52
5.6.200.0030.07318.28
5.6.190.0070.05020.47
5.6.180.0300.07320.79
5.6.170.0300.07320.44
5.6.160.0030.05720.45
5.6.150.0000.09318.18
5.6.140.0030.08718.14
5.6.130.0130.04018.18
5.6.120.0100.08020.98
5.6.110.0070.05721.00
5.6.100.0070.08320.97
5.6.90.0030.07721.09
5.6.80.0100.06020.52
5.5.350.0130.03720.50
5.5.340.0030.04718.02
5.5.330.0100.03720.42
5.5.320.0000.09020.24
5.5.310.0270.04020.27
5.5.300.0130.06317.95
5.5.290.0030.08318.04
5.5.280.0170.07320.97
5.5.270.0170.07020.80
5.5.260.0230.05720.98
5.5.250.0100.04320.46
5.5.240.3900.04020.16

preferences:
55.6 ms | 400 KiB | 5 Q