3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "hello my friend"; $newString = ''; foreach(str_split($string) as $char) { $asciiCode = ord($char); // 97 - a // 122 - z if ($asciiCode >= 97 && $asciiCode < 122) { $char += 1; } if (in_array($char, ['a', 'e', 'y', 'u', 'i', 'o'])) { // not 32, because we already added 1 before $char -= 33; } $newString .= (char) $char; }

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)
5.4.340.0270.07019.14
5.4.320.0230.03319.15
5.4.310.0300.07019.21
5.4.300.0230.07318.85
5.4.290.0200.07719.13
5.4.280.0200.04018.94
5.4.270.0300.07019.26
5.4.260.0170.06319.14
5.4.250.0270.06319.07
5.4.240.0230.05719.30
5.4.230.0270.05018.94
5.4.220.0230.06018.91
5.4.210.0200.04318.81
5.4.200.0230.04319.08
5.4.190.0300.07019.14
5.4.180.0230.07319.19
5.4.170.0230.06019.07
5.4.160.0270.06018.83
5.4.150.0200.04019.20
5.4.140.0200.04716.52
5.4.130.0170.07016.31
5.4.120.0300.05016.33
5.4.110.0130.05716.37
5.4.100.0230.05716.45
5.4.90.0230.06716.45
5.4.80.0230.05716.54
5.4.70.0330.04016.44
5.4.60.0270.03716.48
5.4.50.0170.05316.48
5.4.40.0200.04716.43
5.4.30.0230.07316.54
5.4.20.0170.03716.52
5.4.10.0200.03316.16
5.4.00.0130.04015.79
5.3.290.0200.05014.57
5.3.280.0230.07714.53
5.3.270.0230.07314.44
5.3.260.0170.05014.65
5.3.250.0200.05014.51
5.3.240.0230.07014.44
5.3.230.0270.06714.54
5.3.220.0230.05014.65
5.3.210.0170.05314.62
5.3.200.0200.06014.66
5.3.190.0230.07014.42
5.3.180.0330.06714.37
5.3.170.0200.05714.43
5.3.160.0230.04014.41
5.3.150.0130.06014.50
5.3.140.0170.04014.54
5.3.130.0270.04014.58
5.3.120.0130.05014.50
5.3.110.0130.04014.58
5.3.100.0100.04013.95
5.3.90.0100.04013.86
5.3.80.0130.03713.96
5.3.70.0130.03713.97
5.3.60.0170.03314.03
5.3.50.0170.03313.97
5.3.40.0130.03313.97
5.3.30.0170.04013.76
5.3.20.0200.03013.64
5.3.10.0170.03713.50
5.3.00.0170.03313.49
5.2.170.0100.03012.31
5.2.160.0130.02712.31
5.2.150.0170.03012.31
5.2.140.0170.02312.31
5.2.130.0170.02712.31
5.2.120.0100.02712.31
5.2.110.0130.02312.31
5.2.100.0130.03012.31
5.2.90.0070.03312.31
5.2.80.0170.02312.31
5.2.70.0130.02712.31
5.2.60.0100.03012.31
5.2.50.0130.03312.31
5.2.40.0100.02712.31
5.2.30.0030.03312.31
5.2.20.0100.03012.31
5.2.10.0070.03012.31
5.2.00.0070.03012.31
5.1.60.0070.02312.31
5.1.50.0130.02012.31
5.1.40.0100.02312.31
5.1.30.0100.02712.31
5.1.20.0130.02312.31
5.1.10.0070.02712.31
5.1.00.0130.02012.31
5.0.50.0030.02312.31
5.0.40.0070.01712.31
5.0.30.0070.02712.31
5.0.20.0100.01312.31
5.0.10.0070.02012.31
5.0.00.0070.03012.31
4.4.90.0070.01312.31
4.4.80.0000.01712.31
4.4.70.0070.01312.31
4.4.60.0000.02012.31
4.4.50.0000.01712.31
4.4.40.0070.02312.31
4.4.30.0030.01712.31
4.4.20.0070.01312.31
4.4.10.0030.01712.31
4.4.00.0030.02712.31
4.3.110.0170.00712.31
4.3.100.0100.01712.31
4.3.90.0070.01312.31
4.3.80.0070.02012.31
4.3.70.0000.01712.31
4.3.60.0070.01012.31
4.3.50.0030.01312.31
4.3.40.0070.02012.31
4.3.30.0030.01312.31
4.3.20.0000.01712.31
4.3.10.0030.03012.31
4.3.00.0070.02012.31

preferences:
146.05 ms | 1398 KiB | 7 Q