3v4l.org

run code in 300+ PHP versions simultaneously
<?php function longest_palendrome($string) { $words = explode(' ', $string); $longest = ''; foreach ($words as $word) { $letters = $reversed = explode('', $word); array_reverse($reversed); if ($letters === implode('', $reversed) && strlen($word) > strlen($longest)) { $longest = $word; } } return $word; } 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.0120.00316.75
8.3.50.0140.00917.58
8.3.40.0070.01118.80
8.3.30.0090.00618.59
8.3.20.0040.00418.77
8.3.10.0030.00518.65
8.3.00.0050.00319.38
8.2.180.0060.00916.63
8.2.170.0040.01122.96
8.2.160.0060.00918.93
8.2.150.0080.00024.18
8.2.140.0110.00424.66
8.2.130.0020.00526.16
8.2.120.0050.00219.66
8.2.110.0070.00320.90
8.2.100.0080.00417.91
8.2.90.0000.00919.22
8.2.80.0050.00517.97
8.2.70.0040.00417.63
8.2.60.0000.00917.80
8.2.50.0040.00418.07
8.2.40.0030.00519.35
8.2.30.0050.00517.69
8.2.20.0080.00317.63
8.2.10.0000.00817.85
8.2.00.0040.00417.84
8.1.270.0050.00323.99
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0090.00023.80
8.1.230.0090.00319.00
8.1.220.0040.00417.76
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0000.00917.35
8.1.180.0090.00318.10
8.1.170.0040.00418.89
8.1.160.0000.00818.96
8.1.150.0000.00718.63
8.1.140.0000.00717.45
8.1.130.0000.00717.45
8.1.120.0000.00717.43
8.1.110.0070.00017.44
8.1.100.0040.00417.46
8.1.90.0030.00517.43
8.1.80.0000.00717.46
8.1.70.0000.00717.46
8.1.60.0040.00417.57
8.1.50.0040.00417.39
8.1.40.0040.00417.56
8.1.30.0040.00417.54
8.1.20.0000.01317.53
8.1.10.0040.00417.61
8.1.00.0050.00317.50
8.0.300.0040.00418.84
8.0.290.0000.00716.88
8.0.280.0070.00018.51
8.0.270.0030.00317.25
8.0.260.0030.00316.80
8.0.250.0060.00316.90
8.0.240.0030.00317.00
8.0.230.0090.00017.01
8.0.220.0000.00716.90
8.0.210.0030.00317.01
8.0.200.0000.00716.97
8.0.190.0000.00717.00
8.0.180.0000.00716.88
8.0.170.0050.00316.99
8.0.160.0070.00017.02
8.0.150.0030.00617.01
8.0.140.0000.00716.84
8.0.130.0050.00013.37
8.0.120.0070.00316.89
8.0.110.0000.00717.01
8.0.100.0000.00816.99
8.0.90.0040.00416.73
8.0.80.0060.01016.93
8.0.70.0000.00816.82
8.0.60.0090.00016.77
8.0.50.0000.00917.00
8.0.30.0090.00617.10
8.0.20.0080.01016.99
8.0.10.0070.00017.11
8.0.00.0120.00716.63
7.4.330.0050.00013.05
7.4.320.0030.00316.55
7.4.300.0060.00016.50
7.4.290.0030.00616.58
7.4.280.0040.00416.47
7.4.270.0080.00016.58
7.4.260.0050.00213.24
7.4.250.0070.00316.63
7.4.240.0030.00316.57
7.4.230.0000.00716.44
7.4.220.0200.00716.48
7.4.210.0210.00016.63
7.4.200.0030.00316.41
7.4.190.0060.00316.39
7.4.160.0140.00716.71
7.4.150.0030.01316.68
7.4.140.0150.00917.86
7.4.130.0140.01016.44
7.4.120.0070.01416.71
7.4.110.0100.01616.47
7.4.100.0090.00916.41
7.4.90.0110.00816.51
7.4.80.0120.00919.39
7.4.70.0090.00916.65
7.4.60.0070.01516.69
7.4.50.0040.00016.61
7.4.40.0060.00916.48
7.4.30.0150.00316.67
7.4.00.0070.00714.99
7.3.330.0030.00313.45
7.3.320.0030.00313.46
7.3.310.0000.00716.47
7.3.300.0030.00316.29
7.3.290.0080.00616.42
7.3.280.0030.01716.41
7.3.270.0140.00316.44
7.3.260.0090.00816.41
7.3.240.0110.00616.46
7.3.230.0050.01116.45
7.3.210.0080.00916.40
7.3.200.0040.01816.51
7.3.190.0090.00816.43
7.3.180.0090.00616.60
7.3.170.0030.01316.44
7.3.160.0120.00616.56
7.3.120.0070.01014.88
7.2.330.0040.01416.68
7.2.320.0080.01116.59
7.2.310.0130.00716.78
7.2.300.0060.00916.74
7.2.290.0170.00716.76
7.2.00.0080.00619.50
7.1.100.0060.00618.35
7.1.70.0030.00716.93
7.1.60.0130.01019.25
7.1.50.0100.01416.94
7.1.00.0030.03322.57
7.0.200.0000.00716.74
7.0.140.0030.07322.00
7.0.60.0030.08319.82
7.0.50.0030.07317.88
7.0.40.0100.07717.71
7.0.30.0070.04017.75
7.0.20.0100.08317.75
7.0.10.0070.06317.71
7.0.00.0070.08317.68
5.6.210.0100.03320.51
5.6.200.0070.08318.16
5.6.190.0100.04318.16
5.6.180.0030.04318.16
5.6.170.0070.08318.24
5.6.160.0030.07718.16
5.6.150.0030.08318.30
5.6.140.0100.07718.24
5.6.130.0100.07318.21
5.6.120.0000.04718.21
5.6.110.0100.03318.17
5.6.100.0070.03718.18
5.6.90.0000.04318.14
5.6.80.0070.06717.54
5.6.70.0000.04017.65
5.6.60.0000.04017.65
5.6.50.0030.03717.51
5.6.40.0000.04717.51
5.6.30.0000.05017.54
5.6.20.0070.03717.65
5.6.10.0030.03717.53
5.6.00.0000.04017.52
5.5.350.0200.07320.31
5.5.340.0070.06718.04
5.5.330.0130.06017.95
5.5.320.0000.04317.97
5.5.310.0100.08017.93
5.5.300.0070.07317.95
5.5.290.0070.03718.08
5.5.280.0000.04317.98
5.5.270.0200.03317.95
5.5.260.0070.04017.93
5.5.250.0100.03717.79
5.5.240.0100.03017.38
5.5.230.0070.03717.36
5.5.220.0030.03717.34
5.5.210.0000.04317.43
5.5.200.0030.04017.34
5.5.190.0070.03317.43
5.5.180.0000.04017.35
5.5.160.0000.04017.34
5.5.150.0070.03317.32
5.5.140.0030.03717.27
5.5.130.0030.03717.32
5.5.120.0000.04017.38
5.5.110.0000.05317.33
5.5.100.0100.04317.24
5.5.90.0030.03717.23
5.5.80.0070.03717.25
5.5.70.0070.07717.18
5.5.60.0170.05017.23
5.5.50.0170.06317.29
5.5.40.0030.07717.23
5.5.30.0030.04017.18
5.5.20.0030.04017.29
5.5.10.0030.07017.16
5.5.00.0100.07317.17
5.4.450.0070.08019.38
5.4.440.0070.03719.42
5.4.430.0000.04019.27
5.4.420.0000.04019.45
5.4.410.0030.03719.25
5.4.400.0000.04019.05
5.4.390.0000.04019.13
5.4.380.0030.03719.09
5.4.370.0030.03719.04
5.4.360.0070.03319.09
5.4.350.0070.03319.03
5.4.340.0030.03719.05
5.4.320.0070.03319.05
5.4.310.0100.03019.03
5.4.300.0030.04019.09
5.4.290.0070.03719.03
5.4.280.0030.03719.13
5.4.270.0030.03718.98
5.4.260.0070.03319.09
5.4.250.0070.03319.04
5.4.240.0030.03719.12
5.4.230.0000.04319.09
5.4.220.0030.06019.00
5.4.210.0000.08019.09
5.4.200.0100.07019.04
5.4.190.0000.07719.04
5.4.180.0000.04719.10
5.4.170.0030.06019.08
5.4.160.0130.04318.96
5.4.150.0030.05019.00
5.4.140.0030.04716.46
5.4.130.0070.03316.32
5.4.120.0030.03716.39
5.4.110.0230.05716.47
5.4.100.0030.03716.45
5.4.90.0030.05016.46
5.4.80.0100.07316.45
5.4.70.0030.04716.46
5.4.60.0070.07316.53
5.4.50.0130.07016.32
5.4.40.0100.07716.45
5.4.30.0030.07016.48
5.4.20.0070.07716.52
5.4.10.0130.06316.43
5.4.00.0070.07315.96
5.3.290.0030.03714.70
5.3.280.0030.06014.81
5.3.270.0030.08014.66
5.3.260.0030.04714.64
5.3.250.0100.07314.65
5.3.240.0130.07014.59
5.3.230.0000.05014.64
5.3.220.0070.03714.62
5.3.210.0030.04014.62
5.3.200.0070.07714.57
5.3.190.0070.08014.60
5.3.180.0030.07314.61
5.3.170.0030.04714.55
5.3.160.0030.04014.59
5.3.150.0100.05014.62
5.3.140.0100.05714.57
5.3.130.0000.08314.61
5.3.120.0070.07314.59
5.3.110.0030.08014.50
5.3.100.0000.07314.11
5.3.90.0100.07314.05
5.3.80.0030.07313.91
5.3.70.0070.07714.05
5.3.60.0030.07713.84
5.3.50.0000.06713.79
5.3.40.0030.04014.00
5.3.30.0070.04713.76
5.3.20.0030.04713.59
5.3.10.0030.07313.63
5.3.00.0030.07713.66
5.2.170.0070.03011.18
5.2.160.0030.03011.18
5.2.150.0030.03311.07
5.2.140.0070.03011.18
5.2.130.0070.06011.00
5.2.120.0100.05711.12
5.2.110.0030.03311.07
5.2.100.0030.06311.15
5.2.90.0070.03011.06
5.2.80.0030.06310.98
5.2.70.0130.06011.09
5.2.60.0100.06011.04
5.2.50.0100.03710.86
5.2.40.0070.03011.05
5.2.30.0100.06011.18
5.2.20.0070.02711.16
5.2.10.0130.04710.84
5.2.00.0100.05310.75
5.1.60.0000.0409.98
5.1.50.0030.03710.03
5.1.40.0030.0379.95
5.1.30.0070.05310.36
5.1.20.0100.05010.32
5.1.10.0000.04710.04
5.1.00.0100.03710.04
5.0.50.0030.0278.54
5.0.40.0000.0208.24
5.0.30.0000.0678.06
5.0.20.0070.0378.18
5.0.10.0000.0478.20
5.0.00.0030.0638.23
4.4.90.0030.0277.49
4.4.80.0030.0237.49
4.4.70.0070.0107.49
4.4.60.0000.0177.49
4.4.50.0100.0107.49
4.4.40.0000.0337.49
4.4.30.0030.0377.49
4.4.20.0000.0377.49
4.4.10.0070.0207.49
4.4.00.0000.0307.49
4.3.110.0000.0307.49
4.3.100.0030.0237.49
4.3.90.0000.0337.49
4.3.80.0000.0577.49
4.3.70.0000.0277.49
4.3.60.0070.0307.49
4.3.50.0030.0337.49
4.3.40.0070.0437.49
4.3.30.0030.0307.49
4.3.20.0000.0377.49
4.3.10.0030.0207.49
4.3.00.0000.0307.49

preferences:
65.87 ms | 400 KiB | 5 Q