3v4l.org

run code in 500+ PHP versions simultaneously
<?php $data['slider'] = [1,2,3,4,5,6,7,8,9]; $sliced_array = array_slice($data["slider"], 0, 3); var_export($sliced_array); // preserving the keys is useless echo "\n***\n"; // Shuffle the keys and loop through them to create a new, randomized array of images. shuffle($sliced_array); var_export($sliced_array); // reordered elements are reindexed echo "\n***\n"; $data['slider'] = $sliced_array + array_slice($data["slider"], 0); // starting slice from zero is the default, so the parameter is not needed var_export($data);

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)
7.4.10.0030.01415.06
7.4.00.0060.01315.03
7.3.130.0060.00914.98
7.3.120.0100.01015.08
7.3.110.0090.00314.73
7.3.100.0120.00314.87
7.3.90.0100.00314.72
7.3.80.0080.00615.12
7.3.70.0040.00714.84
7.3.60.0140.00014.53
7.3.50.0000.00814.77
7.3.40.0030.01014.92
7.3.30.0080.00614.60
7.3.20.0060.00816.89
7.3.10.0070.00716.70
7.3.00.0030.01216.37
7.2.260.0060.01215.03
7.2.250.0110.00815.06
7.2.240.0100.00514.88
7.2.230.0030.00714.96
7.2.220.0030.01014.87
7.2.210.0030.00615.24
7.2.200.0100.00314.82
7.2.190.0060.00615.25
7.2.180.0000.00815.11
7.2.170.0030.00714.66
7.2.160.0050.00514.98
7.2.150.0070.00716.89
7.2.140.0060.00616.84
7.2.130.0060.01216.81
7.2.120.0030.01017.06
7.2.110.0040.01116.91
7.2.100.0000.01417.17
7.2.90.0090.00316.77
7.2.80.0140.00315.71
7.2.70.0770.00915.91
7.2.60.0080.01015.86
7.2.50.0100.00815.88
7.2.40.1420.00615.98
7.2.30.0580.00616.12
7.2.20.0090.00915.78
7.2.10.0090.00915.89
7.2.00.0050.01215.89
7.1.330.0110.00315.53
7.1.320.0000.01015.77
7.1.310.0030.00615.59
7.1.300.0000.00815.89
7.1.290.0000.01115.68
7.1.280.0030.01215.79
7.1.270.0000.01015.89
7.1.260.0060.00315.88
7.1.250.0070.01015.74
7.1.240.0000.01515.93
7.1.230.0030.00915.62
7.1.220.0030.01015.98
7.1.210.0030.01015.91
7.1.200.0030.01015.93
7.1.190.0090.00514.63
7.1.180.0120.00714.78
7.1.170.0060.00914.82
7.1.160.1210.00614.93
7.1.150.1090.01214.89
7.1.140.0100.00714.98
7.1.130.0090.00614.68
7.1.120.1130.00714.70
7.1.110.1510.00314.71
7.1.100.1390.00514.92
7.1.90.1170.00514.64
7.1.80.1240.00314.71
7.1.70.1070.01114.86
7.1.60.1390.01123.96
7.1.50.2080.01223.95
7.1.40.2110.01223.65
7.1.30.0470.01023.69
7.1.20.0380.00823.73
7.1.10.0040.01014.55
7.1.00.0540.00214.70
7.0.330.0080.00815.10
7.0.320.0000.01315.50
7.0.310.0030.00615.22
7.0.300.0040.00715.57
7.0.290.0000.01115.38
7.0.280.0070.00715.63
7.0.270.0000.01215.41
7.0.260.0080.00315.39
7.0.250.0000.01515.38
7.0.240.0030.01015.28
7.0.230.0060.00315.60
7.0.220.0060.00615.28
7.0.210.0110.00315.25
7.0.200.0000.00915.51
7.0.190.0090.00615.19
7.0.180.0040.00715.46
7.0.170.0000.00915.59
7.0.160.0030.00915.36
7.0.150.0100.00715.53
7.0.140.0030.01015.22
7.0.130.0040.00415.39
7.0.120.0080.00415.34
7.0.110.0120.00015.50
7.0.100.0040.00415.41
7.0.90.0040.00715.42
7.0.80.0030.00615.48
7.0.70.0030.00715.45
7.0.60.0060.00615.43
7.0.50.0070.00715.50
7.0.40.0090.00613.44
7.0.30.0100.00313.55
7.0.20.0030.01013.46
7.0.10.0040.01113.57
7.0.00.0040.00713.47
5.6.400.0030.00614.84
5.6.390.0030.01414.61
5.6.380.0060.00814.57
5.6.370.0060.00914.65
5.6.360.0070.00714.65
5.6.350.0000.01014.61
5.6.340.0070.00714.57
5.6.330.0060.00914.09
5.6.320.0090.00614.47
5.6.310.0050.00514.23
5.6.300.0100.00314.64
5.6.290.0060.00914.47
5.6.280.0070.00414.46
5.6.270.0030.00914.50
5.6.260.0040.01114.36
5.6.250.0080.00014.63
5.6.240.0000.01714.61
5.6.230.0030.00614.16
5.6.220.0000.00914.54
5.6.210.0070.00314.63
5.6.200.0000.01414.35
5.6.190.0090.00614.31
5.6.180.0040.00814.29
5.6.170.0090.00314.52
5.6.160.0030.00614.40
5.6.150.0060.00914.16
5.6.140.0060.00614.30
5.6.130.0030.01314.39
5.6.120.0100.00314.49
5.6.110.0040.00414.49
5.6.100.0070.01014.29
5.6.90.0070.01014.28
5.6.80.0000.01714.30
5.6.70.0040.00414.25
5.6.60.0070.01014.30
5.6.50.0040.00714.36
5.6.40.0000.01014.29
5.6.30.0050.00514.39
5.6.20.0040.00814.52
5.6.10.0040.00814.39
5.6.00.0100.00314.26

preferences:
52.87 ms | 1140 KiB | 5 Q