3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Demo { public function __construct(private string $val) { } public function get_sku() { return [ 'abc' => 1, 'def' => 2, 'ghi' => 3, 'jkl' => 4, ][$this->val]; } } $cart = (object) [ 'cart_contents' => [ ['data' => new Demo('ghi')], ['data' => new Demo('def')], ['data' => new Demo('jkl')], ['data' => new Demo('abc')], ] ]; $skus = []; $items_to_sort = []; foreach ($cart->cart_contents as $item ) { $skus[] = $item['data']->get_sku(); } array_multisort($skus, $cart->cart_contents); var_export($cart->cart_contents);

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.5.20.0080.01120.11
8.5.10.0100.00716.76
8.5.00.0150.00720.20
8.4.160.0120.01221.57
8.4.150.0020.00114.05
8.4.140.0130.01017.51
8.4.130.0080.00417.64
8.4.120.0100.01124.43
8.4.110.0110.00922.18
8.4.100.0090.01018.66
8.4.90.0130.00818.91
8.4.80.0140.00720.47
8.4.70.0020.00617.79
8.4.60.0130.00818.91
8.4.50.0100.01020.46
8.4.40.0160.00317.50
8.4.30.0060.01518.80
8.4.20.0170.00319.64
8.4.10.0060.00319.64
8.3.290.0140.00720.84
8.3.280.0130.00718.40
8.3.270.0100.00916.84
8.3.260.0090.01016.33
8.3.250.0030.00518.86
8.3.240.0120.00717.18
8.3.230.0110.00916.75
8.3.220.0080.01019.23
8.3.210.0050.00318.45
8.3.200.0060.00316.85
8.3.190.0120.00717.36
8.3.180.0120.00617.35
8.3.170.0120.00620.76
8.3.160.0110.00717.20
8.3.150.0060.01217.26
8.3.140.0040.01119.14
8.3.130.0080.00018.46
8.3.120.0040.00419.16
8.3.110.0080.00018.58
8.3.100.0130.00716.66
8.3.90.0070.00726.77
8.3.80.0050.00518.30
8.3.70.0140.00716.88
8.3.60.0180.00018.38
8.3.50.0120.00916.68
8.3.40.0130.00719.71
8.3.30.0160.00319.09
8.3.20.0180.00021.76
8.3.10.0070.01121.89
8.3.00.0120.00618.97
8.2.300.0110.01122.18
8.2.290.0070.00920.64
8.2.280.0030.00618.58
8.2.270.0000.00817.48
8.2.260.0040.00418.25
8.2.250.0040.00416.92
8.2.240.0030.00617.25
8.2.230.0000.00820.94
8.2.220.0040.00424.06
8.2.210.0110.00426.77
8.2.200.0030.00616.75
8.2.190.0090.01218.30
8.2.180.0090.00616.50
8.2.170.0130.00618.98
8.2.160.0100.01020.17
8.2.150.0040.01519.27
8.2.140.0060.01220.57
8.2.130.0090.00920.43
8.2.120.0040.01519.45
8.2.110.0060.01219.40
8.2.100.0130.00619.36
8.2.90.0130.00618.96
8.2.80.0160.00419.36
8.2.70.0070.01118.72
8.2.60.0100.01018.85
8.2.50.0090.00919.16
8.2.40.0100.01018.73
8.2.30.0190.00318.70
8.2.20.0070.01418.83
8.2.10.0160.00018.71
8.2.00.0100.00618.50
8.1.340.0140.00717.69
8.1.330.0120.00721.79
8.1.320.0140.00715.82
8.1.310.0000.00718.28
8.1.300.0060.00919.83
8.1.290.0080.00330.84
8.1.280.0170.00325.92
8.1.270.0070.00722.08
8.1.260.0140.00722.10
8.1.250.0100.01022.02
8.1.240.0140.00718.75
8.1.230.0120.00918.63
8.1.220.0200.00018.92
8.1.210.0100.01018.57
8.1.200.0130.00618.84
8.1.190.0130.00718.68
8.1.180.0080.00818.41
8.1.170.0160.00618.68
8.1.160.0100.00718.57
8.1.150.0140.00718.87
8.1.140.0060.00918.79
8.1.130.0090.01218.72
8.1.120.0040.01918.32
8.1.110.0100.01718.63
8.1.100.0040.01119.92
8.1.90.0100.00718.59
8.1.80.0030.01419.72
8.1.70.0060.00918.70
8.1.60.0090.00918.55
8.1.50.0040.01418.54
8.1.40.0180.00018.68
8.1.30.0070.00718.94
8.1.20.0110.00419.92
8.1.10.0060.01218.69
8.1.00.0110.00418.52

preferences:
89.05 ms | 403 KiB | 5 Q