3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '2DAYSALEGATE_PG1.jpg', '2DAYSALEGATE_PG2.jpg', '722_PG1.jpg', 'PW_PG2_COKE_A.jpg', 'PW_PG3_COKE_A.jpg', 'PWBY4_DELI-1.jpg' ]; function sortArrayOfStrings($array): array { array_multisort( str_replace('_', ' ', $array), SORT_NATURAL, $array ); return $array; } function dimaSort($array): array { usort($array, function ($a, $b) { $aTemp = str_replace('_', '0', $a); $bTemp = str_replace('_', '0', $b); return strcmp($aTemp,$bTemp); }); return $array; } var_export([ sortArrayOfStrings($array), dimaSort($array) ]);

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.4.120.0060.00323.96
8.4.110.0050.00518.78
8.4.100.0140.00617.57
8.4.90.0090.01020.57
8.4.80.0050.00318.78
8.4.70.0100.00618.80
8.4.60.0140.00619.07
8.4.50.0140.00617.54
8.4.40.0030.01620.75
8.4.30.0120.00920.48
8.4.20.0130.00917.72
8.4.10.0030.00522.12
8.3.250.0110.00518.98
8.3.240.0040.00416.42
8.3.230.0070.00216.84
8.3.220.0110.00618.86
8.3.210.0080.01116.56
8.3.200.0080.00116.47
8.3.190.0140.00818.74
8.3.180.0040.00416.44
8.3.170.0090.00616.41
8.3.160.0030.01016.49
8.3.150.0070.01017.23
8.3.140.0050.00317.24
8.3.130.0060.00316.50
8.3.120.0030.00620.68
8.3.110.0040.01118.28
8.3.100.0070.00016.50
8.3.90.0050.00218.18
8.3.80.0030.00616.75
8.3.70.0160.00016.63
8.3.60.0150.00316.75
8.3.50.0150.00020.19
8.3.40.0100.00321.89
8.3.30.0110.00418.58
8.3.20.0060.00324.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.290.0120.00716.43
8.2.280.0150.00818.65
8.2.270.0140.00717.00
8.2.260.0110.00319.03
8.2.250.0030.00618.34
8.2.240.0150.00317.16
8.2.230.0060.00320.94
8.2.220.0090.00924.06
8.2.210.0040.00426.77
8.2.200.0060.00616.50
8.2.190.0120.00318.29
8.2.180.0040.01125.92
8.2.170.0060.01218.96
8.2.160.0110.00422.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0080.00020.50
8.2.110.0030.00719.19
8.2.100.0120.00017.78
8.2.90.0050.00319.35
8.2.80.0000.00817.97
8.2.70.0060.00317.60
8.2.60.0060.00318.05
8.2.50.0000.00818.07
8.2.40.0040.00419.88
8.2.30.0040.00418.00
8.2.20.0040.00422.13
8.2.10.0000.00718.08
8.2.00.0030.00619.31
8.1.330.0110.00916.41
8.1.320.0120.00716.33
8.1.310.0120.00318.68
8.1.300.0040.00416.45
8.1.290.0060.00330.84
8.1.280.0070.00725.92
8.1.270.0060.00323.99
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0110.00721.25
8.1.230.0110.00017.52
8.1.220.0080.00017.78
8.1.210.0050.00318.77
8.1.200.0000.01117.35
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0080.00018.50
8.1.160.0040.00418.78
8.1.150.0000.00818.65
8.1.140.0000.00717.48
8.1.130.0030.00318.91
8.1.120.0000.00717.53
8.1.110.0030.00317.39
8.1.100.0050.00217.43
8.1.90.0040.00417.49
8.1.80.0100.00717.36
8.1.70.0060.01017.45
8.1.60.0130.00617.45
8.1.50.0120.00617.47
8.1.40.0070.00917.51
8.1.30.0100.00517.65
8.1.20.0090.00917.69
8.1.10.0120.00617.55
8.1.00.0080.00817.39
8.0.300.0040.00418.77
8.0.290.0000.00716.63
8.0.280.0030.00318.39
8.0.270.0000.00716.80
8.0.260.0000.00718.46
8.0.250.0030.00316.89
8.0.240.0030.00316.81
8.0.230.0060.00316.90
8.0.220.0000.00816.91
8.0.210.0080.00016.93
8.0.200.0090.00616.94
8.0.190.0000.01216.87
8.0.180.0040.00816.94
8.0.170.0110.00416.87
8.0.160.0100.00516.93
8.0.150.0090.00616.77
8.0.140.0080.00616.93
8.0.130.0120.00316.86
8.0.120.0060.01016.75
8.0.110.0080.00616.81
8.0.100.0150.00016.78
8.0.90.0070.00716.89
8.0.80.0080.00816.82
8.0.70.0120.00416.82
8.0.60.0140.00516.71
8.0.50.0070.00716.71
8.0.30.0130.00316.71
8.0.20.0120.00316.99
8.0.10.0160.00016.86
7.4.330.0000.00615.55
7.4.320.0030.00316.45
7.4.300.0080.00416.56
7.4.290.0090.00616.54
7.4.280.0120.00516.56
7.4.270.0090.00516.62
7.4.260.0150.00316.54
7.4.250.0110.00616.68
7.4.240.0110.00316.57
7.4.230.0060.01016.52
7.4.220.0070.00716.51
7.4.210.0150.00016.63
7.4.200.0150.00016.60
7.4.190.0070.00716.58
7.4.180.0140.00016.69
7.4.160.0030.00916.57
7.4.150.0070.00716.52
7.4.140.0070.00716.50
7.4.130.0150.00016.40
7.4.120.0100.00516.56
7.4.110.0100.00316.46
7.4.100.0070.00716.39
7.4.90.0040.01116.37
7.4.80.0070.00716.36
7.4.70.0130.00016.34
7.4.60.0110.00216.45
7.4.50.0060.00616.41
7.4.40.0140.00016.21
7.4.30.0110.00416.36
7.4.20.0060.00616.43
7.4.10.0070.00716.50
7.4.00.0070.00716.51

preferences:
27.37 ms | 403 KiB | 5 Q