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); $arr = array_merge(array_flip($keys), $arr); } $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.00.0370.00714.69
7.2.130.0330.01614.92
7.2.120.0350.00814.75
7.2.110.0410.00915.02
7.2.100.0370.01414.94
7.2.90.0330.00815.00
7.2.80.0510.00915.01
7.2.70.0430.01514.98
7.2.60.0420.01214.95
7.2.50.0520.00314.99
7.2.40.0290.01214.86
7.2.30.0340.01615.02
7.2.20.0440.00914.82
7.2.10.0540.00915.13
7.2.00.0570.00615.14
7.1.250.0450.00813.91

preferences:
17.63 ms | 401 KiB | 5 Q