3v4l.org

run code in 300+ PHP versions simultaneously
<?php function longest_palendrome($string) { $current = $longest = ''; foreach (str_split(strrev($string)) as $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.01416.38
8.3.50.0170.00516.51
8.3.40.0110.00718.51
8.3.30.0110.00418.53
8.3.20.0000.00818.64
8.3.10.0000.00818.77
8.3.00.0160.00319.38
8.2.180.0100.00716.38
8.2.170.0150.00622.96
8.2.160.0110.00320.91
8.2.150.0070.00025.66
8.2.140.0000.00924.66
8.2.130.0090.00026.16
8.2.120.0000.00719.83
8.2.110.0060.00321.02
8.2.100.0060.00617.91
8.2.90.0090.00017.63
8.2.80.0060.00317.97
8.2.70.0040.00417.93
8.2.60.0000.00718.09
8.2.50.0080.00018.10
8.2.40.0040.00419.30
8.2.30.0040.00419.30
8.2.20.0050.00317.64
8.2.10.0070.00017.72
8.2.00.0040.00417.73
8.1.280.0180.00025.92
8.1.270.0040.00424.66
8.1.260.0000.00926.35
8.1.250.0040.00428.09
8.1.240.0100.00317.11
8.1.230.0060.00617.56
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0080.00017.36
8.1.190.0080.00019.01
8.1.180.0050.00318.10
8.1.170.0080.00018.72
8.1.160.0000.00718.84
8.1.150.0050.00318.55
8.1.140.0050.00217.48
8.1.130.0030.00317.73
8.1.120.0000.00817.50
8.1.110.0040.00417.43
8.1.100.0000.00717.45
8.1.90.0030.00417.45
8.1.80.0040.00417.46
8.1.70.0030.00317.43
8.1.60.0040.00417.60
8.1.50.0040.00417.36
8.1.40.0040.00417.49
8.1.30.0030.00517.68
8.1.20.0000.00717.55
8.1.10.0020.00517.57
8.1.00.0000.00717.45
8.0.300.0040.00418.77
8.0.290.0030.00716.73
8.0.280.0070.00018.50
8.0.270.0000.00717.19
8.0.260.0040.00416.77
8.0.250.0050.00316.99
8.0.240.0040.00416.95
8.0.230.0000.00716.98
8.0.220.0000.00716.95
8.0.210.0030.00516.88
8.0.200.0000.00716.82
8.0.190.0070.00416.99
8.0.180.0030.00516.93
8.0.170.0000.00816.87
8.0.160.0050.00217.01
8.0.150.0000.00816.72
8.0.140.0030.00616.87
8.0.130.0060.00013.38
8.0.120.0040.00416.86
8.0.110.0080.00016.87
8.0.100.0030.00316.73
8.0.90.0000.00716.88
8.0.80.0110.00416.83
8.0.70.0040.00416.75
8.0.60.0040.00416.82
8.0.50.0080.00016.77
8.0.30.0060.01217.30
8.0.20.0050.01217.11
8.0.10.0030.00516.97
8.0.00.0050.01316.80
7.4.330.0030.00313.00
7.4.320.0040.00416.39
7.4.300.0040.00416.53
7.4.290.0040.00416.59
7.4.280.0000.00916.64
7.4.270.0040.00416.45
7.4.260.0000.00513.25
7.4.250.0000.00816.47
7.4.240.0020.00516.50
7.4.230.0030.00316.56
7.4.220.0040.01716.63
7.4.210.0090.00816.56
7.4.200.0070.00016.33
7.4.190.0040.00416.68
7.4.160.0040.01216.35
7.4.150.0100.00716.48
7.4.140.0080.01016.55
7.4.130.0110.00816.65
7.4.120.0140.00616.55
7.4.110.0070.01016.40
7.4.100.0140.00316.59
7.4.90.0070.01016.41
7.4.80.0070.01019.39
7.4.70.0070.01016.39
7.4.60.0190.00016.48
7.4.50.0110.00016.32
7.4.40.0040.00816.37
7.4.30.0070.01016.30
7.4.00.0000.00815.06
7.3.330.0070.00013.12
7.3.320.0000.00513.09
7.3.310.0070.00016.33
7.3.300.0030.00316.16
7.3.290.0040.01116.30
7.3.280.0120.00416.28
7.3.270.0200.00016.26
7.3.260.0130.01016.65
7.3.250.0110.00816.32
7.3.240.0060.01216.29
7.3.230.0080.00816.60
7.3.210.0060.00916.33
7.3.200.0100.01316.46
7.3.190.0060.01116.61
7.3.180.0110.00416.46
7.3.170.0120.00916.41
7.3.160.0050.01016.57
7.3.120.0090.00614.90
7.3.10.0060.00816.72
7.3.00.0060.00616.52
7.2.330.0140.00716.79
7.2.320.0060.01316.76
7.2.310.0070.01116.77
7.2.300.0130.00316.79
7.2.290.0080.00816.60
7.2.130.0040.00717.00
7.2.120.0100.00717.05
7.2.110.0000.01217.02
7.2.100.0040.01116.79
7.2.90.0060.00616.92
7.2.80.0070.00416.95
7.2.70.0040.00816.98
7.2.60.0050.00816.61
7.2.50.0070.00316.79
7.2.40.0080.00316.96
7.2.30.0070.01016.80
7.2.20.0060.00616.89
7.2.10.0070.01116.93
7.2.00.0060.00518.23
7.1.250.0000.00815.71
7.1.200.0000.00715.93
7.1.100.0060.01218.16
7.1.70.0060.00316.95
7.1.60.0140.01119.40
7.1.50.0040.01816.86
7.1.00.0070.06022.48
7.0.200.0000.00716.71
7.0.140.0130.06721.95
7.0.120.0030.03322.26
7.0.60.0070.03719.90
7.0.50.0070.08317.92
7.0.40.0070.07717.72
7.0.30.0100.08317.77
7.0.20.0030.08317.80
7.0.10.0100.06017.85
7.0.00.0070.05717.85
5.6.280.0000.07321.02
5.6.210.0030.06720.44
5.6.200.0170.07718.29
5.6.190.0000.08018.21
5.6.180.0100.07318.19
5.6.170.0030.08318.12
5.6.160.0030.08018.20
5.6.150.0130.07318.12
5.6.140.0070.05718.24
5.6.130.0030.07018.14
5.6.120.0000.04718.11
5.6.110.0100.08018.27
5.6.100.0070.06318.21
5.6.90.0070.08718.27
5.6.80.0100.05717.57
5.6.70.0100.05017.55
5.6.60.0030.04017.57
5.6.50.0070.04017.66
5.6.40.0070.07717.64
5.6.30.0070.07717.49
5.6.20.0030.08017.57
5.6.10.0030.04317.63
5.6.00.0130.07017.61
5.5.350.0200.08320.42
5.5.340.0000.05718.08
5.5.330.0100.03317.98
5.5.320.0270.05717.98
5.5.310.0030.05718.01
5.5.300.0070.08017.98
5.5.290.0030.04717.96
5.5.280.0070.07717.96
5.5.270.0000.07018.07
5.5.260.0070.07317.98
5.5.250.0070.07017.80
5.5.240.0070.05317.42
5.5.230.0130.05017.39
5.5.220.0030.04017.34
5.5.210.0130.03017.33
5.5.200.0330.03717.34
5.5.190.0100.06017.38
5.5.180.0200.06317.34
5.5.160.0100.07717.44
5.5.150.0030.05017.38
5.5.140.0000.05717.30
5.5.130.0070.08017.43
5.5.120.0070.05017.33
5.5.110.0100.07317.33
5.5.100.0070.07717.23
5.5.90.0030.08017.29
5.5.80.0030.05017.17
5.5.70.0100.05317.33
5.5.60.0070.06017.19
5.5.50.0000.08317.19
5.5.40.0070.07717.32
5.5.30.0070.04317.24
5.5.20.0130.06017.31
5.5.10.0030.06317.32
5.5.00.0130.07317.22
5.4.450.0070.05719.36
5.4.440.0030.08319.60
5.4.430.0030.08019.32
5.4.420.0100.08019.43
5.4.410.0130.04019.08
5.4.400.0100.06319.05
5.4.390.0030.04319.01
5.4.380.0100.03019.03
5.4.370.0070.06319.11
5.4.360.0030.08719.27
5.4.350.0070.05019.10
5.4.340.0230.03719.09
5.4.320.0100.06018.88
5.4.310.0070.07319.02
5.4.300.0000.07018.88
5.4.290.0030.04019.13
5.4.280.0100.06718.88
5.4.270.0070.05719.09
5.4.260.0000.06019.13
5.4.250.0030.06719.08
5.4.240.0130.03719.04
5.4.230.0070.07019.09
5.4.220.0100.03319.04
5.4.210.0030.07319.08
5.4.200.0200.03719.25
5.4.190.0030.06719.09
5.4.180.0130.06719.00
5.4.170.0130.06019.00
5.4.160.0070.05019.01
5.4.150.0070.06018.99
5.4.140.0100.05716.38
5.4.130.0070.03716.40
5.4.120.0030.06316.52
5.4.110.0030.03716.32
5.4.100.0030.03316.38
5.4.90.0000.04016.34
5.4.80.0000.03716.38
5.4.70.0000.03716.44
5.4.60.0000.03716.22
5.4.50.0100.03016.45
5.4.40.0070.03016.51
5.4.30.0000.03716.47
5.4.20.0030.03316.43
5.4.10.0030.03316.35
5.4.00.0000.03716.01
5.3.290.0100.07314.52
5.3.280.0070.07314.63
5.3.270.0030.08014.61
5.3.260.0100.07714.60
5.3.250.0100.07314.63
5.3.240.0070.03714.60
5.3.230.0070.07314.55
5.3.220.0100.06314.61
5.3.210.0030.04714.58
5.3.200.0030.03714.61
5.3.190.0030.03714.58
5.3.180.0030.03714.60
5.3.170.0070.03314.52
5.3.160.0000.04014.66
5.3.150.0000.04014.41
5.3.140.0070.03314.58
5.3.130.0000.04314.50
5.3.120.0030.03714.59
5.3.110.0070.03314.57
5.3.100.0000.03714.04
5.3.90.0000.03714.08
5.3.80.0000.03714.04
5.3.70.0000.03714.05
5.3.60.0000.03714.20
5.3.50.0000.03713.79
5.3.40.0000.03713.99
5.3.30.0030.03313.93
5.3.20.0030.04013.74
5.3.10.0000.04313.70
5.3.00.0000.03713.47
5.2.170.0030.02711.20
5.2.160.0070.03011.18
5.2.150.0030.02711.25
5.2.140.0100.02011.15
5.2.130.0000.03011.10
5.2.120.0070.02311.14
5.2.110.0000.03011.00
5.2.100.0030.02711.16
5.2.90.0100.02011.12
5.2.80.0030.02711.15
5.2.70.0000.03011.07
5.2.60.0030.02711.09
5.2.50.0070.02311.06
5.2.40.0000.03311.02
5.2.30.0030.02710.87
5.2.20.0000.03010.99
5.2.10.0030.02710.91
5.2.00.0100.02010.66
5.1.60.0070.02710.05
5.1.50.0000.02310.09
5.1.40.0030.02710.05
5.1.30.0030.03710.34
5.1.20.0070.02310.39
5.1.10.0030.05710.13
5.1.00.0030.03710.07
5.0.50.0100.0408.54
5.0.40.0070.0208.45
5.0.30.0000.0678.25
5.0.20.0030.0378.26
5.0.10.0030.0378.16
5.0.00.0070.0408.25
4.4.90.0000.0137.55
4.4.80.0000.0137.55
4.4.70.0000.0177.55
4.4.60.0000.0177.55
4.4.50.0000.0137.55
4.4.40.0000.0237.55
4.4.30.0000.0177.55
4.4.20.0000.0207.55
4.4.10.0000.0377.55
4.4.00.0000.0477.55
4.3.110.0030.0207.55
4.3.100.0030.0337.55
4.3.90.0100.0277.55
4.3.80.0070.0477.55
4.3.70.0000.0307.55
4.3.60.0000.0237.55
4.3.50.0000.0207.55
4.3.40.0070.0207.55
4.3.30.0000.0377.55
4.3.20.0000.0307.55
4.3.10.0000.0237.55
4.3.00.0030.0307.55

preferences:
48.14 ms | 401 KiB | 5 Q