3v4l.org

run code in 300+ PHP versions simultaneously
<?php function longest_palendrome($string) { $current = $longest = ''; foreach (str_split(strrev($string)) as $char) { echo $char; if (strstr($current . $char, $string)) { $current .= $char; } elseif (!empty($current) && strlen($current) > strlen($longest)) { $longest = $current; } } return $longest; } echo longest_palendrome("i ama racecar");

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.0070.01118.55
8.3.50.0130.00718.37
8.3.40.0120.00618.88
8.3.30.0070.00718.63
8.3.20.0040.00418.65
8.3.10.0000.00818.60
8.3.00.0040.00419.26
8.2.180.0140.00716.75
8.2.170.0040.01122.96
8.2.160.0000.01518.69
8.2.150.0000.00824.18
8.2.140.0070.00724.66
8.2.130.0040.00426.16
8.2.120.0040.00421.06
8.2.110.0000.00820.56
8.2.100.0070.00419.23
8.2.90.0050.00517.75
8.2.80.0000.00818.55
8.2.70.0030.00717.50
8.2.60.0000.00817.91
8.2.50.0000.00818.07
8.2.40.0000.00919.22
8.2.30.0000.00817.58
8.2.20.0000.01117.46
8.2.10.0040.00417.83
8.2.00.0040.00417.78
8.1.280.0140.00025.92
8.1.270.0050.00323.99
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0030.00623.71
8.1.230.0090.00320.85
8.1.220.0000.00817.78
8.1.210.0060.00318.77
8.1.200.0030.00617.35
8.1.190.0050.00317.23
8.1.180.0000.00818.10
8.1.170.0030.00618.75
8.1.160.0040.00418.88
8.1.150.0080.00018.70
8.1.140.0000.00717.45
8.1.130.0000.00717.44
8.1.120.0050.00217.36
8.1.110.0000.00717.44
8.1.100.0030.00417.41
8.1.90.0070.00017.42
8.1.80.0040.00417.45
8.1.70.0040.00417.42
8.1.60.0040.00417.48
8.1.50.0040.00417.36
8.1.40.0030.00617.39
8.1.30.0040.00417.55
8.1.20.0070.00417.51
8.1.10.0000.00817.57
8.1.00.0070.00017.43
8.0.300.0080.00018.77
8.0.290.0040.00416.63
8.0.280.0000.00718.55
8.0.270.0030.00317.20
8.0.260.0030.00316.73
8.0.250.0040.00416.97
8.0.240.0030.00316.91
8.0.230.0060.00316.96
8.0.220.0000.00816.85
8.0.210.0000.00716.86
8.0.200.0040.00416.83
8.0.190.0070.00016.87
8.0.180.0000.00816.80
8.0.170.0030.00716.92
8.0.160.0070.00016.92
8.0.150.0040.00416.89
8.0.140.0040.00416.84
8.0.130.0050.00013.40
8.0.120.0070.00316.83
8.0.110.0000.00816.77
8.0.100.0000.00716.76
8.0.90.0000.00716.83
8.0.80.0130.00316.83
8.0.70.0050.00316.82
8.0.60.0000.00816.93
8.0.50.0080.00016.70
8.0.30.0090.00916.91
8.0.20.0110.00817.18
8.0.10.0000.00817.12
8.0.00.0090.00916.74
7.4.330.0050.00012.97
7.4.320.0030.00316.49
7.4.300.0030.00316.36
7.4.290.0060.00516.54
7.4.280.0040.00416.51
7.4.270.0040.00416.44
7.4.260.0000.00613.18
7.4.250.0070.00316.43
7.4.240.0000.00816.51
7.4.230.0070.00016.68
7.4.220.0120.00816.48
7.4.210.0140.00716.59
7.4.200.0040.00416.57
7.4.190.0000.00816.46
7.4.160.0050.01116.38
7.4.150.0060.01316.32
7.4.140.0130.00617.86
7.4.130.0150.00716.54
7.4.120.0060.01016.55
7.4.110.0170.00716.36
7.4.100.0060.01216.51
7.4.90.0120.00616.62
7.4.80.0030.01319.39
7.4.70.0120.00616.41
7.4.60.0040.01216.42
7.4.50.0000.00516.46
7.4.40.0120.00416.46
7.4.30.0050.01516.45
7.4.00.0140.00415.00
7.3.330.0000.00613.22
7.3.320.0060.00013.14
7.3.310.0000.00716.14
7.3.300.0030.00316.16
7.3.290.0070.00816.29
7.3.280.0120.00316.27
7.3.270.0070.01016.46
7.3.260.0040.01616.42
7.3.240.0030.01316.39
7.3.230.0060.01116.65
7.3.210.0140.00316.64
7.3.200.0000.01716.52
7.3.190.0030.01316.63
7.3.180.0090.00616.56
7.3.170.0120.00516.44
7.3.160.0100.00716.65
7.3.120.0040.01115.15
7.3.10.0150.00615.86
7.3.00.0070.01015.93
7.2.330.0120.00616.51
7.2.320.0080.01316.41
7.2.310.0070.01716.55
7.2.300.0060.01616.72
7.2.290.0060.01216.57
7.2.130.0070.01116.52
7.2.120.0160.00916.08
7.2.110.0130.00616.09
7.2.100.0030.01416.21
7.2.90.0130.00616.32
7.2.80.0110.00716.27
7.2.70.0070.01116.64
7.2.60.0060.00916.34
7.2.50.0180.00616.30
7.2.40.0140.00416.83
7.2.30.0070.01416.84
7.2.20.0180.00316.42
7.2.10.0060.01316.71
7.2.00.0080.00717.86
7.1.250.0150.00315.21
7.1.100.0030.00918.08
7.1.70.0090.00317.25
7.1.60.0120.01219.25
7.1.50.0140.01017.03
7.1.00.0000.03722.33
7.0.200.0000.00816.46
7.0.140.0070.07022.09
7.0.60.0130.07320.02
7.0.50.0100.06317.84
7.0.40.0130.07017.73
7.0.30.0100.04017.79
7.0.20.0070.08017.68
7.0.10.0030.05017.85
7.0.00.0100.04317.72
5.6.280.0070.07021.12
5.6.210.0000.04320.70
5.6.200.0130.07318.18
5.6.190.0100.09018.18
5.6.180.0030.05018.25
5.6.170.0200.07718.15
5.6.160.0030.08318.29
5.6.150.0070.07318.20
5.6.140.0070.08318.28
5.6.130.0000.06018.21
5.6.120.0030.08018.18
5.6.110.0130.07018.18
5.6.100.0030.07718.16
5.6.90.0100.07718.12
5.6.80.0070.07717.55
5.6.70.0030.06317.68
5.6.60.0100.06017.52
5.6.50.0030.05317.53
5.6.40.0100.07717.57
5.6.30.0070.06317.61
5.6.20.0100.07317.54
5.6.10.0030.04717.64
5.6.00.0170.04317.52
5.5.350.0070.06020.45
5.5.340.0070.05017.96
5.5.330.0030.08017.96
5.5.320.0130.07317.96
5.5.310.0100.08018.09
5.5.300.0100.05017.99
5.5.290.0130.04317.99
5.5.280.0070.08017.95
5.5.270.0100.08318.01
5.5.260.0100.07717.98
5.5.250.0000.04317.82
5.5.240.0100.07717.37
5.5.230.0000.06717.32
5.5.220.0070.07717.34
5.5.210.0030.05317.45
5.5.200.0070.08017.31
5.5.190.0030.05017.30
5.5.180.0000.05717.27
5.5.160.0000.04317.35
5.5.150.0100.07017.36
5.5.140.0070.08017.34
5.5.130.0070.03717.38
5.5.120.0100.07317.30
5.5.110.0030.08317.42
5.5.100.0070.07017.33
5.5.90.0070.08317.23
5.5.80.0070.07017.33
5.5.70.0070.04317.19
5.5.60.0000.08717.24
5.5.50.0130.06717.30
5.5.40.0000.05017.20
5.5.30.0070.07717.21
5.5.20.0100.05717.25
5.5.10.0000.07717.23
5.5.00.0070.04017.17
5.4.450.0070.07019.46
5.4.440.0170.07319.46
5.4.430.0070.06019.37
5.4.420.0100.07319.21
5.4.410.0070.04319.22
5.4.400.0130.07319.02
5.4.390.0130.07019.12
5.4.380.0070.05019.03
5.4.370.0000.04319.02
5.4.360.0030.08018.91
5.4.350.0130.05319.01
5.4.340.0100.03719.05
5.4.320.0030.04019.00
5.4.310.0070.07019.09
5.4.300.0000.07719.00
5.4.290.0130.03319.05
5.4.280.0070.05319.09
5.4.270.0130.06718.98
5.4.260.0000.07019.27
5.4.250.0070.04719.00
5.4.240.0030.08019.02
5.4.230.0070.04719.04
5.4.220.0100.06719.04
5.4.210.0030.08318.90
5.4.200.0100.07719.09
5.4.190.0100.07719.05
5.4.180.0000.09019.04
5.4.170.0030.06019.25
5.4.160.0030.07719.03
5.4.150.0030.07719.00
5.4.140.0000.04016.46
5.4.130.0070.07016.21
5.4.120.0100.05316.41
5.4.110.0100.06316.48
5.4.100.0070.07716.39
5.4.90.0100.05316.38
5.4.80.0070.05716.41
5.4.70.0030.04016.21
5.4.60.0000.04016.41
5.4.50.0030.03716.41
5.4.40.0030.04016.34
5.4.30.0070.03316.52
5.4.20.0030.03316.45
5.4.10.0030.03716.42
5.4.00.0030.03315.66
5.3.290.0000.04314.51
5.3.280.0100.07714.65
5.3.270.0070.08014.46
5.3.260.0030.05314.64
5.3.250.0030.04314.63
5.3.240.0070.04314.56
5.3.230.0100.07314.62
5.3.220.0000.07714.55
5.3.210.0070.07714.41
5.3.200.0000.08014.59
5.3.190.0100.07014.54
5.3.180.0030.04714.61
5.3.170.0030.04014.59
5.3.160.0170.02314.57
5.3.150.0070.03314.41
5.3.140.0000.04014.60
5.3.130.0030.03714.55
5.3.120.0030.03714.57
5.3.110.0070.03314.58
5.3.100.0030.03714.09
5.3.90.0030.05714.05
5.3.80.0030.03714.22
5.3.70.0030.03714.11
5.3.60.0000.03714.05
5.3.50.0030.03714.15
5.3.40.0000.03713.83
5.3.30.0000.03713.95
5.3.20.0000.03713.91
5.3.10.0000.03713.85
5.3.00.0000.04013.73
5.2.170.0000.03011.22
5.2.160.0030.02711.18
5.2.150.0000.03311.18
5.2.140.0000.03011.18
5.2.130.0070.02311.16
5.2.120.0000.03011.31
5.2.110.0000.03311.10
5.2.100.0000.03011.31
5.2.90.0030.02711.09
5.2.80.0070.02311.12
5.2.70.0030.02711.12
5.2.60.0000.03011.04
5.2.50.0000.03010.92
5.2.40.0070.02310.84
5.2.30.0030.02710.87
5.2.20.0000.03010.99
5.2.10.0070.02310.89
5.2.00.0070.02310.77
5.1.60.0030.0209.94
5.1.50.0030.0239.98
5.1.40.0030.0239.95
5.1.30.0000.02710.18
5.1.20.0000.02710.39
5.1.10.0030.0239.90
5.1.00.0000.03010.28
5.0.50.0000.0208.56
5.0.40.0000.0208.45
5.0.30.0030.0408.30
5.0.20.0000.0308.26
5.0.10.0070.0178.16
5.0.00.0030.0678.23
4.4.90.0000.0177.55
4.4.80.0000.0207.55
4.4.70.0000.0177.55
4.4.60.0030.0207.55
4.4.50.0000.0177.55
4.4.40.0000.0237.55
4.4.30.0030.0137.55
4.4.20.0030.0137.55
4.4.10.0030.0137.55
4.4.00.0000.0307.55
4.3.110.0000.0177.55
4.3.100.0070.0207.55
4.3.90.0000.0177.55
4.3.80.0030.0537.55
4.3.70.0000.0377.55
4.3.60.0030.0337.55
4.3.50.0000.0307.55
4.3.40.0000.0537.55
4.3.30.0070.0307.55
4.3.20.0000.0407.55
4.3.10.0000.0377.55
4.3.00.0000.0407.55

preferences:
38.98 ms | 401 KiB | 5 Q