3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isPalindrome(string &$str): bool { return (bool) preg_match('/^(?=.)((.)(?1)\2|.?)$/', $str); } function sanitizePalindrome(&$str) { return preg_replace('/[^a-z]+/', '', strtolower($str)); } $tests = [ '', 'radar', 'f', 'neveroddoreven', 'foo', 'palindrome', 'Red rum, sir, is murder' ]; foreach ($tests as $test) { $test = sanitizePalindrome($test); // this is optional printf("%20s : %s\n", $test, json_encode(isPalindrome($test))); }

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.4.120.0130.00722.49
8.4.110.0100.01018.70
8.4.100.0140.00718.05
8.4.90.0110.00917.76
8.4.80.0160.00417.93
8.4.70.0060.00218.28
8.4.60.0100.00818.17
8.4.50.0090.01318.73
8.4.40.0130.00617.75
8.4.30.0100.00618.72
8.4.20.0110.00717.91
8.4.10.0000.00919.65
8.3.250.0100.00918.82
8.3.240.0120.00716.72
8.3.230.0110.00816.62
8.3.220.0110.00717.30
8.3.210.0120.00816.95
8.3.200.0120.00716.53
8.3.190.0120.00716.84
8.3.180.0100.00516.95
8.3.170.0000.01919.04
8.3.160.0190.00017.25
8.3.150.0060.00317.19
8.3.140.0000.00818.35
8.3.130.0070.00418.77
8.3.120.0050.00520.81
8.3.110.0030.00620.94
8.3.100.0030.00616.39
8.3.90.0070.00726.77
8.3.80.0090.00017.97
8.3.70.0120.00918.27
8.3.60.0140.00318.52
8.3.50.0150.00316.64
8.3.40.0070.01321.86
8.3.30.0090.00920.34
8.3.20.0140.00725.66
8.3.10.0090.00925.66
8.3.00.0090.00925.66
8.2.290.0120.00720.41
8.2.280.0120.00718.61
8.2.270.0120.00617.28
8.2.260.0060.00316.51
8.2.250.0090.00018.58
8.2.240.0060.00317.18
8.2.230.0000.00922.58
8.2.220.0060.00624.06
8.2.210.0070.01126.77
8.2.200.0090.00016.63
8.2.190.0170.00316.88
8.2.180.0110.00318.33
8.2.170.0040.01119.04
8.2.160.0100.00322.96
8.2.150.0030.01625.66
8.2.140.0070.01125.66
8.2.130.0140.00425.66
8.2.120.0060.01225.66
8.2.110.0060.00325.66
8.2.100.0040.00425.66
8.2.90.0080.00025.66
8.2.80.0070.00725.66
8.2.70.0030.00625.66
8.2.60.0150.00025.66
8.2.50.0040.01125.66
8.2.40.0040.01125.66
8.2.30.0100.00625.66
8.2.20.0100.01025.66
8.2.10.0030.01725.66
8.2.00.0090.00625.66
8.1.330.0080.00220.00
8.1.320.0130.00620.09
8.1.310.0090.00016.97
8.1.300.0090.00619.92
8.1.290.0080.00430.84
8.1.280.0170.00325.92
8.1.270.0110.00425.66
8.1.260.0100.01025.66
8.1.250.0060.00325.66
8.1.240.0030.00525.66
8.1.230.0050.00325.66
8.1.220.0050.00325.66
8.1.210.0080.00025.66
8.1.200.0030.00625.66
8.1.190.0080.00025.66
8.1.180.0040.00425.66
8.1.170.0080.00025.66
8.1.160.0080.00025.66
8.1.150.0040.00425.66
8.1.140.0000.00825.66
8.1.130.0000.00825.66
8.1.120.0050.00325.66
8.1.110.0060.00325.66
8.1.100.0080.00025.66
8.1.90.0080.00025.66
8.1.80.0030.00625.66
8.1.70.0060.00325.66
8.1.60.0050.00325.66
8.1.50.0080.00025.66
8.1.40.0030.00525.66
8.1.30.0050.00325.66
8.1.20.0030.00525.66
8.1.10.0080.00025.66
8.1.00.0000.00825.66

preferences:
49.98 ms | 403 KiB | 5 Q