3v4l.org

run code in 300+ PHP versions simultaneously
<?php // déclaration de variables $MotsAccent = array(); $Tb = array(); // mes fonctions function accents($text) { $text = htmlentities($text); $text = htmlspecialchars_decode($text); return $text; } function rep_fr_htmlaccents($chaine) { $patterns = array('/&acirc;/','/&auml;/','/&aacute;/','/&agrave;/','/&ecirc;/','/&euml;/','/&eacute;/','/&egrave;/','/&ocirc;/','/&ouml;/','/&oacute;/','/&ograve;/','/&ucirc;/','/&uuml;/','/&uacute;/','/&ugrave;/','/&icirc;/','/&iuml;/','/&iacute;/','/&igrave;/','/&ccedil;/','/&aelig;/'); $rep = array('a','a','a','a','e','e','e','e','o','o','o','o','u','u','u','u','i','i','i','i','c','o'); return preg_replace($patterns, $rep, $chaine); } function IsPalindrome($MotTeste) { $MotOrigine = rep_fr_htmlaccents($MotTeste); $MotInverse = strrev($MotOrigine); If ($MotInverse === $MotOrigine) { return $MotTeste; } return ""; } // fin de mes fonctions ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html;" /> <title>Palindromes</title> </head> <body> <?php //Début du programme $txt = fopen('palindromes.txt','r'); while ($line = fgets($txt)) { $mots=preg_split("/\W+/", $line); for ($i = 0; $i < count($mots); $i++) { if (strlen($mots[$i])>1) { $tef = accents($mots[$i]); array_push($MotsAccent, strtolower($tef)); } } } $MotsDedoubles = array_unique($MotsAccent); foreach($MotsDedoubles as $MotsDedouble) { if ($MotsDedouble!="") { $res = IsPalindrome($MotsDedouble); if ($res!="" && strlen($res)>1) { $Tb[] = $res; } } } echo count($Tb)." Palindromes trouv&eacute;s : <br/>"; for ($i = 0; $i < count($Tb); $i++) { echo $Tb[$i]."<br/>"; } ?> </body> </html>

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.0030.01718.37
8.3.50.0060.01021.87
8.3.40.0040.01118.85
8.3.30.0070.00719.09
8.3.20.0080.00020.18
8.3.10.0030.00621.91
8.3.00.0030.00522.34
8.2.180.0070.01116.63
8.2.170.0040.01122.96
8.2.160.0110.00319.21
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0190.00026.16
8.2.120.0070.00019.82
8.2.110.0110.00020.47
8.2.100.0000.01219.64
8.2.90.0080.00019.22
8.2.80.0030.00617.97
8.2.70.0050.00517.48
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0080.00018.07
8.2.30.0040.00418.05
8.2.20.0000.00717.69
8.2.10.0020.00517.86
8.2.00.0040.00417.72
8.1.280.0170.00325.92
8.1.270.0080.00022.15
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.79
8.1.230.0070.00419.05
8.1.220.0050.00317.74
8.1.210.0030.00618.77
8.1.200.0000.00917.35
8.1.190.0040.00417.46
8.1.180.0000.00818.66
8.1.170.0030.00618.39
8.1.160.0030.00522.23
8.1.150.0040.00418.50
8.1.140.0100.00017.44
8.1.130.0030.00317.88
8.1.120.0050.00217.41
8.1.110.0000.00717.48
8.1.100.0040.00417.50
8.1.90.0040.00417.46
8.1.80.0070.00017.48
8.1.70.0000.00717.46
8.1.60.0000.00817.57
8.1.50.0040.00417.48
8.1.40.0090.00017.54
8.1.30.0060.00317.57
8.1.20.0080.00017.77
8.1.10.0000.00817.53
8.1.00.0000.00817.48
8.0.300.0040.00418.77
8.0.290.0040.00417.04
8.0.280.0000.00718.55
8.0.270.0090.00017.25
8.0.260.0030.00316.90
8.0.250.0040.00417.05
8.0.240.0030.00317.09
8.0.230.0030.00317.05
8.0.220.0030.00316.89
8.0.210.0000.00716.92
8.0.200.0000.00717.08
8.0.190.0000.00717.03
8.0.180.0040.00416.95
8.0.170.0030.00617.02
8.0.160.0040.00417.09
8.0.150.0000.00817.02
8.0.140.0000.00816.96
8.0.130.0000.00613.40
8.0.120.0040.00416.93
8.0.110.0070.00017.01
8.0.100.0000.00716.97
8.0.90.0040.00416.95
8.0.80.0090.00617.05
8.0.70.0000.00716.85
8.0.60.0020.00517.00
8.0.50.0040.00416.84
8.0.30.0060.01417.14
8.0.20.0130.00617.40
8.0.10.0040.00416.96
8.0.00.0060.01316.63
7.4.330.0000.00515.00
7.4.320.0030.00316.66
7.4.300.0000.00616.53
7.4.290.0030.00316.70
7.4.280.0030.00316.54
7.4.270.0030.00316.70
7.4.260.0050.00316.58
7.4.250.0000.00816.61
7.4.240.0040.00416.63
7.4.230.0000.00816.36
7.4.220.0070.01116.67
7.4.210.0070.00816.61
7.4.200.0040.00416.36
7.4.190.0000.00716.58
7.4.160.0070.01316.54
7.4.150.0090.01017.40
7.4.140.0170.02217.86
7.4.130.0060.01116.55
7.4.120.0100.00716.59
7.4.110.0100.01016.40
7.4.100.0090.00916.68
7.4.90.0030.01616.73
7.4.80.0070.01019.39
7.4.70.0130.00516.52
7.4.60.0060.01016.64
7.4.50.0040.00016.66
7.4.40.0060.00922.77
7.4.30.0090.00916.53
7.4.00.0070.01015.08
7.3.330.0030.00313.33
7.3.320.0030.00313.41
7.3.310.0030.00316.51
7.3.300.0000.00716.39
7.3.290.0120.00316.42
7.3.280.0050.01116.51
7.3.270.0080.01017.40
7.3.260.0090.00916.42
7.3.250.0100.00716.53
7.3.240.0130.00316.67
7.3.230.0150.00316.59
7.3.210.0100.00716.45
7.3.200.0190.00319.39
7.3.190.0150.00916.68
7.3.180.0090.00616.40
7.3.170.0200.00316.46
7.3.160.0060.00916.47
7.3.120.0080.01015.05
7.3.110.0060.01114.94
7.3.100.0080.00915.04
7.3.90.0030.00814.94
7.3.80.0060.01014.84
7.3.70.0080.00214.69
7.3.60.0010.00914.86
7.3.50.0040.01014.75
7.3.40.0060.00614.86
7.3.30.0030.01014.87
7.3.20.0060.01116.63
7.3.10.0110.00416.41
7.3.00.0160.00716.66
7.2.330.0180.00016.56
7.2.320.0100.00616.59
7.2.310.0080.00816.70
7.2.300.0130.00816.81
7.2.290.0130.00616.65
7.2.250.0050.01315.18
7.2.240.0070.01315.15
7.2.230.0060.01115.12
7.2.220.0020.01215.00
7.2.210.0080.00615.34
7.2.200.0050.00815.09
7.2.190.0090.00715.16
7.2.180.0000.01314.86
7.2.170.0030.00815.14
7.2.130.0190.00616.74
7.2.120.0040.01416.71
7.2.110.0100.00716.76
7.2.100.0120.00616.42
7.2.90.0070.01016.46
7.2.80.0060.01216.56
7.2.70.0140.00316.91
7.2.60.0100.00716.83
7.2.50.0190.00316.79
7.2.40.0070.00716.84
7.2.30.0000.01416.70
7.2.20.0000.01516.64
7.2.10.0160.00016.69
7.2.00.0080.00618.04
7.1.330.0050.01016.00
7.1.320.0040.01115.71
7.1.310.0050.00915.81
7.1.300.0060.00715.84
7.1.290.0050.01015.84
7.1.280.0050.00815.72
7.1.270.0060.00815.86
7.1.260.0080.00515.56
7.1.250.0110.00715.84
7.1.200.0030.00715.73
7.1.100.0070.00718.25
7.1.70.0080.00017.30
7.1.60.0120.01219.82
7.1.50.0030.02017.07
7.1.00.0000.09722.33
7.0.200.0050.00216.54
7.0.140.0000.07722.00
7.0.60.0130.05020.05
7.0.50.0030.04017.90
7.0.40.0070.04320.13
7.0.30.0270.05320.23
7.0.20.0170.09020.14
7.0.10.0200.05020.09
7.0.00.0030.09020.07
5.6.280.0030.07321.00
5.6.210.0030.04320.52
5.6.200.0100.04718.19
5.6.190.0000.04720.55
5.6.180.3270.03720.33
5.6.170.0170.04720.52
5.6.160.0100.08720.46
5.6.150.0000.07018.19
5.6.140.0030.08018.18
5.6.130.0100.08018.23
5.6.120.0100.06021.04
5.6.110.0100.08321.15
5.6.100.0130.08021.04
5.6.90.0030.04721.12
5.6.80.0030.04020.40
5.6.70.0300.05720.36
5.5.350.0070.08020.45
5.5.340.0170.07317.96
5.5.330.0100.08320.57
5.5.320.0270.07720.29
5.5.310.0170.04020.30
5.5.300.0000.04318.04
5.5.290.0100.08018.02
5.5.280.0100.05320.98
5.5.270.0270.04720.70
5.5.260.0000.08720.65
5.5.250.0170.07320.63
5.5.240.0100.05320.21
5.4.450.0500.07019.48
5.4.440.0670.05719.58
5.4.430.0100.05719.41
5.4.420.0100.05719.36
5.4.410.0100.05319.31
5.4.400.0800.00018.77
5.4.390.0800.00018.48
5.4.380.0230.05718.72
5.4.370.1030.05318.60
5.4.360.0930.03018.83
5.4.350.0830.05018.63
5.4.340.0800.05018.76
5.4.320.0060.03712.53
5.4.310.0050.04612.52
5.4.300.0080.04712.53
5.4.290.0070.03812.52
5.4.280.0080.03412.42
5.4.270.0060.03612.42
5.4.260.0270.05718.75
5.4.250.0100.05019.05
5.4.240.0070.06318.90
5.4.230.0200.04019.05
5.4.220.0070.08019.05
5.4.210.0130.04718.79
5.4.200.0070.05318.86
5.4.190.0170.06318.97
5.4.180.0170.06718.70
5.4.170.0130.04718.70
5.4.160.0030.06018.59
5.4.150.0170.07318.96
5.4.140.0070.05316.50
5.4.130.0000.07016.60
5.4.120.0130.05316.41
5.4.110.0200.04016.63
5.4.100.0070.05016.49
5.4.90.0100.04716.42
5.4.80.0130.04316.46
5.4.70.0070.05016.51
5.4.60.0100.04716.49
5.4.50.0070.05016.34
5.4.40.0130.05316.31
5.4.30.0030.05016.43
5.4.20.0100.04716.45
5.4.10.0070.05016.27
5.4.00.0070.05015.85
5.3.290.0060.04712.80
5.3.280.0030.05314.53
5.3.270.0030.05714.72
5.3.260.0070.06314.62
5.3.250.0170.06714.79
5.3.240.0170.06714.77
5.3.230.0100.06714.52
5.3.220.0100.06014.68
5.3.210.0170.06314.81
5.3.200.0130.04314.50
5.3.190.0030.05314.58
5.3.180.0070.05014.69
5.3.170.0130.04714.66
5.3.160.0100.04714.49
5.3.150.0130.04714.65
5.3.140.0130.04314.41
5.3.130.0100.05014.65
5.3.120.0070.05014.64
5.3.110.0170.04014.68
5.3.100.0100.04714.03
5.3.90.0100.04314.02
5.3.80.0070.05714.04
5.3.70.0070.05013.87
5.3.60.0130.04714.00
5.3.50.0070.05014.14
5.3.40.0030.05014.15
5.3.30.0070.04714.00
5.3.20.0070.04713.80
5.3.10.0130.06013.67
5.3.00.0130.06013.84
5.2.170.0030.04011.26
5.2.160.0000.04311.36
5.2.150.0130.05311.15
5.2.140.0000.04311.17
5.2.130.0070.03711.21
5.2.120.0070.03711.21
5.2.110.0030.04311.21
5.2.100.0000.04311.21
5.2.90.0100.03710.95
5.2.80.0070.04311.28
5.2.70.0170.03011.12
5.2.60.0030.04311.04
5.2.50.0070.04010.95
5.2.40.0100.04011.10
5.2.30.0070.04010.99
5.2.20.0000.04310.97
5.2.10.0100.03710.96
5.2.00.0170.04310.70
5.1.60.0030.05710.09
5.1.50.0030.03710.03
5.1.40.0030.03310.07
5.1.30.0100.04010.45
5.1.20.0070.05010.46
5.1.10.0000.04010.14
5.1.00.0070.03710.16
5.0.50.0030.0278.41
5.0.40.0100.0208.28
5.0.30.0070.0408.09
5.0.20.0030.0338.31
5.0.10.0000.0378.27
5.0.00.0030.0578.18
4.4.90.0030.0206.81
4.4.80.0000.0236.81
4.4.70.0000.0236.81
4.4.60.0000.0236.81
4.4.50.0070.0176.81
4.4.40.0030.0336.81
4.4.30.0000.0236.81
4.4.20.0030.0206.81
4.4.10.0000.0236.81
4.4.00.0000.0336.81
4.3.110.0070.0176.81
4.3.100.0030.0206.81
4.3.90.0070.0176.81
4.3.80.0030.0336.81
4.3.70.0030.0206.81
4.3.60.0070.0176.81
4.3.50.0030.0236.81
4.3.40.0000.0336.81
4.3.30.0000.0236.81
4.3.20.0030.0206.81
4.3.10.0000.0236.81
4.3.00.0030.0279.25

preferences:
35.53 ms | 400 KiB | 5 Q