3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string="developer"; $consonants=[]; for($offset=0, $length=strlen($string); $offset<$length; ++$offset){ // iterate each letter of the string if(strpos('aeiou',$string[$offset])===false){ // isolate the consonants $consonants[]=$string[$offset]; // store the consonant $offsets[]=$offset; // store the offset (aka indexed position of the consonant in the string) } } shuffle($consonants); // shuffle the array of stored consonants foreach($consonants as $index=>$consonant){ // iterate only the stored consonants $string[$offsets[$index]]=$consonant; // reassign the consonants in their new positions } echo $string;

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.0080.00416.65
7.3.00.0110.00616.63
7.2.130.0150.00017.02
7.2.120.0060.00916.76
7.2.110.0040.01316.80
7.2.100.0080.00816.95
7.2.90.0110.00617.02
7.2.80.0120.00816.98
7.2.70.0230.00016.65
7.2.60.0070.01117.09
7.2.50.0070.01216.97
7.2.40.0100.00916.86
7.2.30.0170.00316.68
7.2.20.0150.01017.67
7.2.10.0900.00517.67
7.2.00.0160.01017.84
7.1.250.0160.00415.66
7.1.140.0180.00616.69
7.1.130.0250.00816.84
7.1.120.0170.01116.92
7.1.110.0180.01016.11
7.1.100.0190.00916.29
7.1.90.0200.00816.21
7.1.80.0190.00716.13
7.1.70.0180.01015.23
7.1.60.0350.01233.36
7.1.50.0290.01232.99
7.1.40.0320.00632.53
7.1.30.0380.01132.72
7.1.20.0550.00932.75
7.1.10.0220.01414.84
7.1.00.0210.00714.85

preferences:
30.15 ms | 403 KiB | 5 Q