3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Ovo je samo jedan od testnih kodova"; $a = array('a','e','i','o','u'); $strlen = strlen( $str ); $siz = sizeof($a); $res = ""; $rest = ""; $t= ""; $sugl = array(); $pozsugl = array(); for( $i = 0; $i <= $strlen; $i++ ) { $char = substr( $str, $i, 1 ); $t = false; // $char contains the current character, so do your processing here for($j=0; $j<$siz;$j++) { if($a[$j] === $char) { $t = true; if($j+1 === $siz) { $res.= $a[0]; break; } else { $res .= $a[$j+1]; break; } } } if(!$t) { $res.=$char; array_push($sugl, $char); array_push($pozsugl, $i); } } echo "sugl ".printing($sugl)."\n" ; echo "pozsugl ".printing($pozsugl)."\n"; $sugl = sorty($sugl); echo "sugl poslije sorty ".printing($sugl)."\n"; echo "Rezultat prije ". $res ."\n"; echo "Rezultat nakon svega:" . changeChar($res,$pozsugl, $sugl); function sorty($c) { $siz = sizeof($c); $tmp = $c[0]; for ($i = 1; $i < $siz; $i++) $c[$i - 1] = $c[$i]; $c[$siz - 1] = $tmp; return $c; } function changeChar($str, $pozsugl, $sugl) { $strlen = strlen( $str ); $siz= sizeof($pozsugl); $rez = ""; for($i = 0; $i <= $strlen; $i++) { $char = substr( $str, $i, 1 ); for($j=0; $j<$siz;$j++) { if($i === $pozsugl[$j]) { $char=$sugl[$j]; break; } } $rez.=$char; } return $rez; } function printing($f) { $siz= sizeof($f); $t=""; for($k=0; $k <$siz; $k++) $t.=$f[$k]; echo $t; } ?>

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)
8.3.60.0100.01018.43
8.3.50.0130.00423.03
8.3.40.0090.00618.97
8.3.30.0070.00719.21
8.3.20.0000.00820.34
8.3.10.0030.00620.53
8.3.00.0060.00319.50
8.2.180.0070.01116.75
8.2.170.0140.00022.96
8.2.160.0070.00720.35
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0120.00326.16
8.2.120.0040.00718.77
8.2.110.0090.00019.26
8.2.100.0070.00417.84
8.2.90.0000.00919.30
8.2.80.0000.00919.34
8.2.70.0090.00017.75
8.2.60.0060.00317.93
8.2.50.0050.00318.07
8.2.40.0050.00518.09
8.2.30.0040.00418.24
8.2.20.0000.00817.78
8.2.10.0040.00418.23
8.2.00.0050.00317.87
8.1.280.0090.00625.92
8.1.270.0040.00420.78
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0050.00523.82
8.1.230.0070.00420.97
8.1.220.0050.00318.63
8.1.210.0030.00618.77
8.1.200.0060.00317.10
8.1.190.0080.00017.64
8.1.180.0000.00918.10
8.1.170.0030.00518.86
8.1.160.0050.00218.88
8.1.150.0040.00418.94
8.1.140.0070.00017.56
8.1.130.0030.00317.97
8.1.120.0040.00417.43
8.1.110.0030.00517.48
8.1.100.0000.00717.40
8.1.90.0050.00217.56
8.1.80.0030.00517.49
8.1.70.0030.00317.46
8.1.60.0080.00017.52
8.1.50.0000.00917.57
8.1.40.0000.00717.46
8.1.30.0000.00917.68
8.1.20.0050.00317.66
8.1.10.0040.00417.65
8.1.00.0030.00917.49
8.0.300.0070.00020.21
8.0.290.0040.00416.88
8.0.280.0000.00818.42
8.0.270.0080.00017.24
8.0.260.0030.00317.23
8.0.250.0000.00716.89
8.0.240.0040.00416.98
8.0.230.0040.00416.98
8.0.220.0070.00016.90
8.0.210.0070.00016.94
8.0.200.0030.00316.97
8.0.190.0060.00316.99
8.0.180.0040.00417.02
8.0.170.0040.00416.97
8.0.160.0030.00316.84
8.0.150.0020.00516.93
8.0.140.0040.00416.80
8.0.130.0080.00013.41
8.0.120.0040.00416.82
8.0.110.0050.00216.98
8.0.100.0070.00016.93
8.0.90.0040.00416.74
8.0.80.0120.00416.99
8.0.70.0070.00016.82
8.0.60.0000.00716.79
8.0.50.0040.00416.94
8.0.30.0110.01417.05
8.0.20.0090.00917.42
8.0.10.0050.00216.96
8.0.00.0130.01016.90
7.4.330.0000.00515.20
7.4.320.0030.00316.46
7.4.300.0000.00716.44
7.4.290.0030.00316.66
7.4.280.0000.00816.57
7.4.270.0000.00716.51
7.4.260.0000.00816.66
7.4.250.0040.00416.62
7.4.240.0040.00416.60
7.4.230.0070.00016.41
7.4.220.0100.01016.52
7.4.210.0090.00616.75
7.4.200.0030.00416.51
7.4.160.0110.00516.59
7.4.150.0130.00417.40
7.4.140.0110.01117.86
7.4.130.0050.01216.50
7.4.120.0100.00716.63
7.4.110.0070.01016.78
7.4.100.0080.00916.55
7.4.90.0100.00716.64
7.4.80.0120.00616.67
7.4.70.0150.00816.43
7.4.60.0130.00316.52
7.4.50.0050.00516.57
7.4.40.0130.00316.26
7.4.30.0130.01016.62
7.4.10.0090.00914.89
7.4.00.0070.01215.20
7.3.330.0030.00313.41
7.3.320.0000.00513.40
7.3.310.0000.00716.42
7.3.300.0000.00716.40
7.3.290.0050.01016.38
7.3.280.0110.00616.42
7.3.270.0120.00617.40
7.3.260.0040.01916.54
7.3.250.0170.00316.53
7.3.240.0130.00816.43
7.3.230.0070.01516.39
7.3.210.0180.00416.37
7.3.200.0130.01019.39
7.3.190.0120.00616.70
7.3.180.0040.01116.45
7.3.170.0060.01116.60
7.3.160.0070.01016.43
7.3.130.0100.01014.89
7.3.120.0070.01115.17
7.3.110.0100.01014.92
7.3.100.0000.01414.79
7.3.90.0040.01115.04
7.3.80.0070.00314.91
7.3.70.0000.01115.02
7.3.60.0000.01114.70
7.3.50.0060.00614.76
7.3.40.0030.01114.63
7.3.30.0070.00715.02
7.3.20.0100.00016.75
7.3.10.0000.00916.75
7.3.00.0060.00616.45
7.2.330.0080.01216.87
7.2.320.0120.00616.88
7.2.310.0130.00816.55
7.2.300.0110.00616.88
7.2.290.0170.00316.75
7.2.260.0110.00715.26
7.2.250.0110.00715.02
7.2.240.0090.00915.32
7.2.230.0110.00414.94
7.2.220.0110.00714.95
7.2.210.0110.00015.00
7.2.200.0030.01215.31
7.2.190.0060.00615.15
7.2.180.0070.00315.21
7.2.170.0150.00315.10
7.2.160.0150.00315.17
7.2.150.0000.01517.02
7.2.140.0140.00016.77
7.2.130.0100.00717.00
7.2.120.0030.01516.71
7.2.110.0070.01116.73
7.2.100.0100.00717.05
7.2.90.0100.00316.93
7.2.80.0100.00616.63
7.2.70.0040.01116.69
7.2.60.0030.01016.98
7.2.50.0030.01016.91
7.2.40.0100.00616.87
7.2.30.0040.00716.80
7.2.20.0070.01017.14
7.2.10.0040.01116.91
7.2.00.0020.01017.95
7.1.330.0070.00715.96
7.1.320.0060.00615.82
7.1.310.0000.01415.95
7.1.300.0030.00915.87
7.1.290.0030.00715.47
7.1.280.0100.00615.82
7.1.270.0100.00615.90
7.1.260.0110.00015.87
7.1.250.0030.01315.54
7.1.240.0030.01315.62
7.1.230.0070.01115.63
7.1.220.0030.01315.98
7.1.210.0030.01015.84
7.1.200.0030.01015.96
7.1.190.0040.01116.05
7.1.180.0080.00415.93
7.1.170.0070.00716.02
7.1.160.0000.01315.79
7.1.150.0000.01515.96
7.1.140.0050.00515.77
7.1.130.0030.01015.60
7.1.120.0060.00915.49
7.1.110.0000.01415.90
7.1.100.0220.00516.92
7.1.90.0120.00615.96
7.1.80.0080.00316.02
7.1.70.0040.00716.57
7.1.60.0100.00717.61
7.1.50.0020.00916.36
7.1.40.0060.00315.71
7.1.30.0060.00615.88
7.1.20.0040.01215.80
7.1.10.0120.00315.93
7.1.00.0020.04419.14
7.0.330.0050.00515.32
7.0.320.0060.01015.48
7.0.310.0070.00715.44
7.0.300.0100.00715.57
7.0.290.0040.00415.43
7.0.280.0000.01315.36
7.0.270.0000.01415.45
7.0.260.0060.00615.27
7.0.250.0100.00315.33
7.0.240.0090.00915.20
7.0.230.0080.00315.41
7.0.220.0030.00615.45
7.0.210.0070.00715.24
7.0.200.0070.00516.17
7.0.190.0060.00315.39
7.0.180.0070.00715.34
7.0.170.0070.00315.16
7.0.160.0030.01115.65
7.0.150.0060.01315.24
7.0.140.0080.03818.61
7.0.130.0060.00915.54
7.0.120.0040.01115.70
7.0.110.0090.00615.55
7.0.100.0060.00915.63
7.0.90.0040.01115.51
7.0.80.0090.00615.54
7.0.70.0000.01215.48
7.0.60.0130.04317.75
7.0.50.0070.04716.66
7.0.40.0030.03916.86
7.0.30.0100.03716.86
7.0.20.0200.03816.90
7.0.10.0060.03816.91
7.0.00.0070.04516.96
5.6.400.0000.01014.79
5.6.390.0060.00914.67
5.6.380.0040.00814.69
5.6.370.0060.01014.64
5.6.360.0030.01314.61
5.6.350.0070.00714.47
5.6.340.0060.00914.60
5.6.330.0030.01314.60
5.6.320.0090.00614.63
5.6.310.0000.01314.12
5.6.300.0060.01314.50
5.6.290.0000.01214.55
5.6.280.0050.04217.95
5.6.270.0030.01314.48
5.6.260.0070.01014.45
5.6.250.0120.00014.61
5.6.240.0040.01114.54
5.6.230.0110.00614.70
5.6.220.0030.00714.24
5.6.210.0120.03717.48
5.6.200.0120.04216.22
5.6.190.0080.02317.50
5.6.180.0140.04017.40
5.6.170.0180.03017.43
5.6.160.0040.04817.45
5.6.150.0070.03116.27
5.6.140.0050.04516.28
5.6.130.0070.04416.27
5.6.120.0070.04217.74
5.6.110.0040.04917.71
5.6.100.0100.04017.89
5.6.90.0070.04317.61
5.6.80.0120.04017.46
5.6.70.0090.00614.45
5.6.60.0090.00614.30
5.6.50.0000.00914.36
5.6.40.0070.00714.34
5.6.30.0060.00914.34
5.6.20.0070.00714.70
5.6.10.0040.00814.30
5.6.00.0100.00714.30
5.5.380.0000.01414.67
5.5.370.0030.01314.42
5.5.360.0030.00614.69
5.5.350.2170.02217.54
5.5.340.0100.04316.14
5.5.330.0070.02217.36
5.5.320.0020.02617.39
5.5.310.0150.04217.43
5.5.300.0030.04216.21
5.5.290.0080.04016.12
5.5.280.0030.02817.77
5.5.270.0090.04717.60
5.5.260.0090.02917.50
5.5.250.0110.02017.63
5.5.240.0050.02817.27
5.5.230.0030.00714.22
5.5.220.0030.01014.17
5.5.210.0000.01714.15
5.5.200.0100.01014.35
5.5.190.0060.01314.48
5.5.180.0000.01414.39
5.5.170.0070.01014.25
5.5.160.0060.00914.18
5.5.150.0030.01414.60
5.5.140.0090.00314.30
5.5.130.0110.00414.16
5.5.120.0030.01014.43
5.5.110.0060.00314.42
5.5.100.0120.00314.47
5.5.90.0060.00914.39
5.5.80.0070.00714.49
5.5.70.0100.00314.47
5.5.60.0040.00814.17
5.5.50.0000.01214.49
5.5.40.0040.01114.48
5.5.30.0030.00914.14
5.5.20.0000.01514.56
5.5.10.0070.00714.45
5.5.00.0090.00914.48
5.4.450.0390.02816.16
5.4.440.0430.03516.10
5.4.430.0430.03016.01
5.4.420.0100.03016.13
5.4.410.0120.03116.06
5.4.400.0470.03515.70
5.4.390.0520.03515.78
5.4.380.0530.03915.63
5.4.370.0560.02715.67
5.4.360.0440.03215.60
5.4.350.0130.06512.38
5.4.340.0130.03712.37
5.4.330.0060.00612.72
5.4.320.0150.03412.62
5.4.310.0120.03912.62
5.4.300.0100.04112.62
5.4.290.0090.02912.62
5.4.280.0050.02712.57
5.4.270.0040.02612.56
5.4.260.0080.02812.56
5.4.250.0060.02412.57
5.4.240.0060.02312.57
5.4.230.0090.02212.56
5.4.220.0070.02012.56
5.4.210.0060.02012.56
5.4.200.0090.03812.56
5.4.190.0070.02512.56
5.4.180.0070.02912.56
5.4.170.0090.02112.57
5.4.160.0070.03812.56
5.4.150.0060.02612.56
5.4.140.0090.03012.40
5.4.130.0070.02512.40
5.4.120.0120.05812.37
5.4.110.0110.03312.38
5.4.100.0110.03812.37
5.4.90.0050.03012.37
5.4.80.0120.04412.37
5.4.70.0060.03012.37
5.4.60.0070.02712.37
5.4.50.0100.03612.37
5.4.40.0040.03212.36
5.4.30.0110.02812.37
5.4.20.0050.03612.36
5.4.10.0080.02712.36
5.4.00.0040.02512.11
5.3.290.0130.04212.80
5.3.280.0090.04912.71
5.3.270.0090.06012.72
5.3.260.0130.04612.72
5.3.250.0150.05612.72
5.3.240.0200.07712.72
5.3.230.0110.05512.71
5.3.220.0130.09412.68
5.3.210.0120.05012.68
5.3.200.0120.04412.68
5.3.190.0200.06512.68
5.3.180.0100.03912.68
5.3.170.0060.04412.68
5.3.160.0090.04012.67
5.3.150.0070.04912.68
5.3.140.0090.04312.67
5.3.130.0090.08312.66
5.3.120.0080.05612.66
5.3.110.0090.06012.66
5.3.100.0110.04712.15
5.3.90.0080.05212.13
5.3.80.0140.05612.12
5.3.70.0140.04512.12
5.3.60.0060.04012.11
5.3.50.0080.03912.05
5.3.40.0090.03612.06
5.3.30.0140.05912.02
5.3.20.0100.04011.80
5.3.10.0060.05011.76
5.3.00.0100.04111.75
5.2.170.0060.0359.26
5.2.160.0100.0309.26
5.2.150.0170.0529.26
5.2.140.0090.0379.26
5.2.130.0090.0329.21
5.2.120.0160.0359.22
5.2.110.0060.0399.22
5.2.100.0030.0359.21
5.2.90.0080.0319.21
5.2.80.0120.0399.21
5.2.70.0040.0339.20
5.2.60.0130.0659.16
5.2.50.0120.0789.14
5.2.40.0090.0389.11
5.2.30.0150.0849.08
5.2.20.0060.0409.07
5.2.10.0100.0258.98
5.2.00.0070.0298.84
5.1.60.0110.0378.12
5.1.50.0060.0298.12
5.1.40.0080.0288.09
5.1.30.0030.0458.45
5.1.20.0040.0298.47
5.1.10.0060.0328.20
5.1.00.0050.0318.20
5.0.50.0030.0236.69
5.0.40.0040.0226.55
5.0.30.0050.0316.36
5.0.20.0030.0216.33
5.0.10.0040.0236.30
5.0.00.0050.0346.30
4.4.90.0060.0174.78
4.4.80.0030.0204.75
4.4.70.0040.0224.76
4.4.60.0030.0224.75
4.4.50.0050.0214.77
4.4.40.0080.0344.71
4.4.30.0090.0184.76
4.4.20.0040.0214.84
4.4.10.0050.0194.85
4.4.00.0050.0274.76
4.3.110.0040.0214.66
4.3.100.0020.0244.66
4.3.90.0040.0214.63
4.3.80.0050.0304.60
4.3.70.0060.0194.63
4.3.60.0050.0204.62
4.3.50.0050.0204.62
4.3.40.0030.0334.55
4.3.30.0020.0223.35
4.3.20.0030.0213.34
4.3.10.0050.0193.30
4.3.00.0130.0236.90

preferences:
48.34 ms | 401 KiB | 5 Q