3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sort_array_item_by_size($a, $b): int { static $sizes = [ "XXS" => 0, "XS" => 1, "S" => 2, "M" => 3, "L" => 4, "XL" => 5, "XXL" => 6, ]; // The next three lines really should include some error checking $size_a = explode("_", $a)[1]; $size_b = explode("_", $b)[1]; return $sizes[$size_a] <=> $sizes[$size_b]; } $your_array = ["GL001_XXL", "GL001_L", "GL001_XXS", "GL001_S"]; usort($your_array, "sort_array_item_by_size"); print_r($your_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.0130.00720.68
8.4.110.0100.00922.48
8.4.100.0150.00517.79
8.4.90.0120.00918.68
8.4.80.0140.00719.48
8.4.70.0060.00517.77
8.4.60.0130.00718.82
8.4.50.0050.00517.57
8.4.40.0070.01417.85
8.4.30.0100.01022.17
8.4.20.0060.00317.64
8.4.10.0110.00819.70
8.3.250.0070.00218.95
8.3.240.0100.01016.50
8.3.230.0110.00716.45
8.3.220.0050.01317.29
8.3.210.0080.00918.26
8.3.200.0070.00218.54
8.3.190.0110.00817.20
8.3.180.0070.01220.73
8.3.170.0110.00718.88
8.3.160.0090.00916.70
8.3.150.0110.00720.68
8.3.140.0030.00516.44
8.3.130.0170.00316.69
8.3.120.0120.00018.85
8.3.110.0080.00020.94
8.3.100.0090.00024.06
8.3.90.0060.00326.77
8.3.80.0040.00717.97
8.3.70.0090.00616.25
8.3.60.0120.00416.75
8.3.50.0180.00316.75
8.3.40.0070.01020.21
8.3.30.0080.01521.54
8.3.20.0070.00024.18
8.3.10.0000.00824.66
8.3.00.0040.00426.16
8.2.290.0050.00522.38
8.2.280.0060.00218.42
8.2.270.0110.00716.98
8.2.260.0080.00017.49
8.2.250.0000.00818.41
8.2.240.0080.00818.72
8.2.230.0040.00422.58
8.2.220.0030.00637.54
8.2.210.0110.00726.77
8.2.200.0040.00716.25
8.2.190.0150.00616.63
8.2.180.0110.00716.63
8.2.170.0070.01418.89
8.2.160.0030.01322.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00420.96
8.2.110.0040.00720.52
8.2.100.0200.00719.11
8.2.90.0140.00319.01
8.2.80.0200.01018.94
8.2.70.0000.01020.48
8.2.60.0210.00618.90
8.2.50.0340.00318.72
8.2.40.0270.00719.00
8.2.30.0110.01118.80
8.2.20.0220.00318.79
8.2.10.0250.01319.11
8.2.00.0220.01318.70
8.1.330.0110.00822.10
8.1.320.0090.01116.26
8.1.310.0130.00618.62
8.1.300.0090.00020.23
8.1.290.0050.00530.84
8.1.280.0080.00825.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0200.01018.74
8.1.230.0230.01018.36
8.1.220.0210.00918.63
8.1.210.0170.00719.82
8.1.200.0210.01418.67
8.1.190.0220.00318.29
8.1.180.0210.00718.24
8.1.170.0120.00318.28
8.1.160.0190.00518.60
8.1.150.0110.00420.63
8.1.140.0290.00318.50
8.1.130.0140.00318.45
8.1.120.0210.00418.59
8.1.110.0080.00818.64
8.1.100.0110.00518.55
8.1.90.0220.00318.49
8.1.80.0110.00418.54
8.1.70.0100.00318.72
8.1.60.0260.00618.68
8.1.50.0140.00318.31
8.1.40.0110.00318.68
8.1.30.0130.00018.93
8.1.20.0170.00918.71
8.1.10.0160.01018.79
8.1.00.0200.00818.86
8.0.300.0180.00017.95
8.0.290.0300.00017.61
8.0.280.0040.01917.88
8.0.270.0170.00917.87
8.0.260.0080.00817.70
8.0.250.0190.01517.89
8.0.240.0210.00717.96
8.0.230.0030.00620.26
8.0.220.0060.00617.90
8.0.210.0140.00017.85
8.0.200.0100.00717.86
8.0.190.0240.00017.63
8.0.180.0240.00017.80
8.0.170.0050.00818.00
8.0.160.0150.00317.87
8.0.150.0140.02017.64
8.0.140.0110.00317.71
8.0.130.0200.01018.17
8.0.120.0250.01317.64
8.0.110.0230.01017.85
8.0.100.0320.00617.88
8.0.90.0180.00317.79
8.0.80.0240.00717.79
8.0.70.0190.01117.68
8.0.60.0230.00717.80
8.0.50.0220.00717.74
8.0.30.0110.00317.93
8.0.20.0160.01217.88
8.0.10.0230.00317.93

preferences:
28.36 ms | 403 KiB | 5 Q