3v4l.org

run code in 300+ PHP versions simultaneously
<?php function preserve_shuffle(&$arr) #Shuffles the key-value associations in an array. { $keys = array_keys($arr); #extract the keys from the array. shuffle($keys); for ($index = 0, $length = count($keys); $index < $length; ++$index) { $result[$keys[$index]] = $arr[$keys[$index]]; } $arr = $result; } $arr = ["a" => "apple", "b" => "banana", "c" => "capsicum", "d" => "dill"]; preserve_shuffle($arr); var_export($arr);

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.3.10.0060.00616.85
7.3.00.0250.00415.51
7.2.130.0230.00615.54
7.2.120.0360.00415.59
7.2.110.0260.00815.70
7.2.100.0240.00615.54
7.2.90.0320.00615.78
7.2.80.0310.00715.49
7.2.70.0590.00715.63
7.2.60.0250.01015.80
7.2.50.0330.00415.55
7.2.40.0400.00615.63
7.2.30.0270.00815.73
7.2.20.0350.00715.69
7.2.10.0330.00915.63
7.2.00.0340.00515.46
7.1.250.0250.00614.62

preferences:
15.95 ms | 401 KiB | 5 Q