3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Build the array */ $result = []; for($i=0;$i<4;$i++){ $result[] = [ 'id' => $i + 1, 'title' => 'task '.($i + 1), 'tech_user_id' => 1, 'dev_priority' => $i + 1 ]; } /* Build the array ends */ function reArrange(&$result,$id,$new_dev_priority){ $curr_index = array_search($id,array_column($result,"id"),true); $limit_index = array_search($new_dev_priority,array_column($result,"dev_priority"),true); $process_node = $result[$curr_index]; $curr_dev_priority = $process_node['dev_priority']; if($curr_dev_priority === $new_dev_priority) return; // return if same priority was assigned. $offset = $curr_dev_priority > $new_dev_priority ? -1 : 1; /* rearrange by relocating elements to a new location(this is a minimized push) */ while($curr_index != $limit_index){ $result[$curr_index] = $result[$curr_index + $offset]; $result[$curr_index]['dev_priority'] = $result[$curr_index]['dev_priority'] - $offset; $curr_index += $offset; } $process_node['dev_priority'] = $new_dev_priority; // assign new dev priority $result[$curr_index] = $process_node; } echo "Initial state:##########",PHP_EOL; print_r($result); reArrange($result,3,1); echo "Rearranged state:##########",PHP_EOL; print_r($result);

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.70.0070.01416.59
8.3.60.0120.00318.30
8.3.50.0040.01818.23
8.3.40.0150.00018.64
8.3.30.0120.00618.49
8.3.20.0040.00420.90
8.3.10.0040.00423.61
8.3.00.0090.00022.39
8.2.190.0120.00318.29
8.2.180.0070.01416.50
8.2.170.0110.00422.96
8.2.160.0100.00722.22
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00420.36
8.2.110.0030.00722.31
8.2.100.0120.00017.84
8.2.90.0030.00617.88
8.2.80.0040.00418.04
8.2.70.0060.00318.05
8.2.60.0000.00817.91
8.2.50.0060.00318.10
8.2.40.0050.00219.34
8.2.30.0070.00019.30
8.2.20.0040.00418.12
8.2.10.0040.00419.30
8.2.00.0040.00418.05
8.1.280.0150.00025.92
8.1.270.0030.00619.11
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0000.00919.09
8.1.230.0090.00321.04
8.1.220.0030.00717.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0060.00317.35
8.1.180.0080.00018.10
8.1.170.0040.00418.54
8.1.160.0070.00018.88
8.1.150.0070.00018.84
8.1.140.0020.00520.27
8.1.130.0000.00820.29
8.1.120.0030.00517.36
8.1.110.0080.00317.41
8.1.100.0040.00417.46
8.1.90.0040.00417.47
8.1.80.0000.00717.43
8.1.70.0040.00417.36
8.1.60.0000.00817.50
8.1.50.0000.00717.52
8.1.40.0040.00417.38
8.1.30.0040.00417.68
8.1.20.0030.00617.63
8.1.10.0070.00017.57
8.1.00.0000.00717.54
8.0.300.0000.00820.09
8.0.290.0030.00616.75
8.0.280.0000.00718.50
8.0.270.0030.00316.83
8.0.260.0000.00620.07
8.0.250.0000.00816.99
8.0.240.0030.00316.93
8.0.230.0000.00716.85
8.0.220.0000.00616.85
8.0.210.0000.00716.87
8.0.200.0050.00316.92
8.0.190.0040.00417.00
8.0.180.0030.00616.96
8.0.170.0040.00816.93
8.0.160.0000.00716.92
8.0.150.0040.00416.79
8.0.140.0070.00016.88
8.0.130.0030.00313.37
8.0.120.0030.00516.88
8.0.110.0000.00816.88
8.0.100.0030.00516.92
8.0.90.0040.00416.63
8.0.80.0030.01416.83
8.0.70.0040.00416.70
8.0.60.0000.00716.75
8.0.50.0080.00016.71
8.0.30.0110.00716.95
8.0.20.0130.01917.40
8.0.10.0000.00716.94
8.0.00.0140.00716.87
7.4.330.0000.00515.55
7.4.320.0060.00016.61
7.4.300.0040.00416.50
7.4.290.0080.00316.51
7.4.280.0040.00416.52
7.4.270.0000.00816.66
7.4.260.0030.00516.36
7.4.250.0030.00316.52
7.4.240.0070.00016.38
7.4.230.0000.00716.64
7.4.220.0030.00516.59
7.4.210.0080.00816.62
7.4.200.0030.00316.63
7.4.160.0090.00916.56
7.4.130.0070.01116.58
7.4.120.0060.01516.47
7.4.110.0120.00616.60
7.4.100.0160.00616.30
7.4.90.0130.01016.48
7.4.80.0070.01019.39
7.4.70.0060.01016.41
7.4.60.0090.00616.48
7.4.50.0130.00916.32
7.4.40.0110.00716.32
7.4.00.0030.01314.72
7.3.330.0000.00513.29
7.3.320.0000.00513.24
7.3.310.0000.00716.23
7.3.300.0030.00316.42
7.3.290.0040.00416.37
7.3.280.0080.01016.35
7.3.260.0110.00916.50
7.3.230.0090.00916.56
7.3.210.0200.00316.76
7.3.200.0040.01816.34
7.3.190.0040.01416.68
7.3.180.0140.00416.32
7.3.170.0090.01216.43
7.3.160.0060.01216.35
7.3.30.0150.00614.76
7.3.20.0820.00715.01
7.3.10.0560.01315.04
7.3.00.0920.01014.73
7.2.330.0070.01316.85
7.2.320.0030.01516.56
7.2.310.0120.00616.86
7.2.300.0110.01116.88
7.2.290.0100.01416.69
7.2.160.0110.00415.06
7.2.150.0660.00015.12
7.2.140.0900.00615.23
7.2.130.0680.00315.16
7.2.120.0580.01015.21
7.2.110.0130.00415.11
7.2.100.0620.00615.16
7.2.90.0900.00015.21
7.2.80.0810.00715.33
7.2.70.0640.00814.90
7.2.60.0910.01314.96
7.2.50.0160.00315.03
7.2.40.0250.00414.80
7.2.30.0890.00415.14
7.2.20.0100.01614.82
7.2.10.0130.00715.07
7.2.00.0190.00614.88
7.1.270.0560.00613.82
7.1.260.0630.01914.21
7.1.250.0740.00613.84

preferences:
45.07 ms | 401 KiB | 5 Q