3v4l.org

run code in 300+ PHP versions simultaneously
<?php function shuffleX($arr, $max=3){ $raw=$arr; $x=0; $s=md5('random_string'); while(1){$x++; shuffle($arr); //Build string out of Arr for repeating variables to check $f2=join($s,$arr); $break=true; foreach($raw as $k=>$v){ //Check for repeating variables each Value (forward and Backward) $f=str_repeat($v.$s,$max); $fa=str_repeat($s.$v.'',$max); if(preg_match('#'.$f.'#',$f2) OR preg_match('#'.$fa.'#',$f2)){ $break=false; } } if($break===true){return $arr;} if($x>(count($arr)*1000)){// if nothing found after x Times break or give an empty array return array('unpossible'); } } } $arr=array(1,2,1,1,2,2,1,2,1,2,1); print_r(shuffleX($arr,3)); ?>

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.30.0070.01716.64
7.4.20.0000.01616.35
7.4.10.0130.00316.66
7.4.00.0160.01016.61
7.3.150.0000.01716.51
7.3.140.0070.01016.78
7.3.130.0100.00716.61
7.3.120.0110.00616.78
7.3.110.0070.01716.61
7.3.100.0000.01816.54
7.3.90.0030.01516.49
7.3.80.0080.00816.71
7.3.70.0050.01416.66
7.3.60.0110.00616.57
7.3.50.0100.00616.68
7.3.40.0050.01216.57
7.3.30.0130.00316.66
7.3.20.0140.00316.68
7.3.10.0070.01016.54
7.3.00.0110.00616.59
7.2.280.0000.01816.70
7.2.270.0030.01516.81
7.2.260.0120.00916.86
7.2.250.0070.01417.03
7.2.240.0110.00616.93
7.2.230.0030.01716.89
7.2.220.0100.01016.89
7.2.210.0100.01416.64
7.2.200.0180.00416.77
7.2.190.0100.00716.67
7.2.180.0090.00916.88
7.2.170.0060.01816.71
7.2.160.0070.01016.73
7.2.150.0070.01016.96
7.2.140.0070.01416.78
7.2.130.0090.00916.76
7.2.120.0090.00916.87
7.2.110.0140.00716.78
7.2.100.0120.00616.88
7.2.90.0070.01016.86
7.2.80.0040.01516.78
7.2.70.0150.00916.85
7.2.60.0030.01516.73
7.2.50.0110.00716.84
7.2.40.0130.01316.77
7.2.30.0110.01416.80
7.2.20.0170.00716.77
7.2.10.0120.00916.79
7.2.00.0150.00316.84

preferences:
32.69 ms | 403 KiB | 5 Q